中文论坛 (Forum for Chinese Speakers)

Moderators: ArturoRobles, yuhesky, ArturoRobles, yuhesky

#795921
请问我在流程设计的某个Task的Assignment Rules 里,选择Manual Assignment,我在用REST方式启动流程实例后,如何用REST API设置下一步工作人(通过外部应用页面获取)呢 :?:
#795927
xiaobai wrote:请问我在流程设计的某个Task的Assignment Rules 里,选择Manual Assignment,我在用REST方式启动流程实例后,如何用REST API设置下一步工作人(通过外部应用页面获取)呢 :?:
Translation:
How to manually assign the next step to a person using REST
I would like to ask you in the process of designing a Task Assignment Rules, select Manual Assignment, I use REST way to start the process instance, how to use REST API to set the next step (through the external application page):?:
There is no way to set the next user with the REST API when the next task is Manual Assignment.

You need to use VALUE_BASED_ASSIGNMENT for the task and use a variable such as @@selectedUserId to set the assigned user to the task. You can get a list of the users assigned to the task and let the user in your external application select one to work on the next task.

For example, create the following trigger in your process:
Code: Select all
//set to the ID of the task with VALUE_BASED_ASSIGNMENT
$taskId = 'XXXXXXXXXXXXXXXXXXXXXXXX'; 
@=assignedUsers = array();

G::LoadClass('derivation');
$d = new Derivation();
$aUsers = $ d->getAllUsersFromAnyTask($taskId);
   
foreach ($aUsers as $userId) {
      $aUserInfo = userInfo($userId);
      $name = $aUserInfo['firstname'] .' '. $aUserInfo['lastname'] .' ('. $aUserInfo['username'] .')';
      @=assignedUsers[] = array($userId, $name);
} 
See: http://wiki.processmaker.com/3.0/Intern ... Task.28.29

Then, in your external application:
1. Call PUT /api/1.0/{workspace}/cases/{app_uid}/execute-trigger/{tri_uid} to execute the above trigger.
2. Call GET /api/1.0/{workspace}/cases/{app_uid}/variables to get the @=assignedUsers array.
3. Use the list of users in @=assignedUsers to populate a dropdown in your external application, so that the user can select a user to assign to the task with VALUE_BASED_ASSIGNMENT.
4. After the user submits the form, then call PUT /cases/{app_uid}/variable to set the value of @@selectedUserId in the case.
5. Finally call PUT /cases/{app_uid}/route-case
#795932
amosbatto wrote:
xiaobai wrote:请问我在流程设计的某个Task的Assignment Rules 里,选择Manual Assignment,我在用REST方式启动流程实例后,如何用REST API设置下一步工作人(通过外部应用页面获取)呢 :?:
Translation:
How to manually assign the next step to a person using REST
I would like to ask you in the process of designing a Task Assignment Rules, select Manual Assignment, I use REST way to start the process instance, how to use REST API to set the next step (through the external application page):?:
There is no way to set the next user with the REST API when the next task is Manual Assignment.

You need to use VALUE_BASED_ASSIGNMENT for the task and use a variable such as @@selectedUserId to set the assigned user to the task. You can get a list of the users assigned to the task and let the user in your external application select one to work on the next task.

For example, create the following trigger in your process:
Code: Select all
//set to the ID of the task with VALUE_BASED_ASSIGNMENT
$taskId = 'XXXXXXXXXXXXXXXXXXXXXXXX'; 
@=assignedUsers = array();

G::LoadClass('derivation');
$d = new Derivation();
$aUsers = $ d->getAllUsersFromAnyTask($taskId);
   
foreach ($aUsers as $userId) {
      $aUserInfo = userInfo($userId);
      $name = $aUserInfo['firstname'] .' '. $aUserInfo['lastname'] .' ('. $aUserInfo['username'] .')';
      @=assignedUsers[] = array($userId, $name);
}
See: http://wiki.processmaker.com/3.0/Intern ... Task.28.29

Then, in your external application:
1. Call PUT /api/1.0/{workspace}/cases/{app_uid}/execute-trigger/{tri_uid} to execute the above trigger.
2. Call GET /api/1.0/{workspace}/cases/{app_uid}/variables to get the @=assignedUsers array.
3. Use the list of users in @=assignedUsers to populate a dropdown in your external application, so that the user can select a user to assign to the task with VALUE_BASED_ASSIGNMENT.
4. After the user submits the form, then call PUT /cases/{app_uid}/variable to set the value of @@selectedUserId in the case.
5. Finally call PUT /cases/{app_uid}/route-case
Thanks,it's very helpful.I'll try it later.

Maybe try increasing your thread stack size? Seems[…]

I use PM 3.4. Android push works while IOS push do[…]

[quote=ziadeh post_id=823031 time=1550759948 user_[…]

I have to support reports in processmaker 3.4. A s[…]