Hi,

Is there any API call or any other way available to map the participant dynamically?

Im planning to develop a custom plugin Say I need to get the Username from a form as input and map that User as the participant dynamically to the next activity/task.

For example, I will have a Request and Approve tasks in my workflow, in my Request form i will have a drop-down which will have the User list who will be the Approver and on selecting this, the participant needs to be mapped dynamically and the tasks will go to that particular User's Inbox and he can approve or reject the request.

Kindly let me know whether any API calls available to fetch the Users and map them dynamically.

Thanks,

Vignesh

  • No labels

12 Comments

  1. You don't need an API for this. It's a feature available in Joget Workflow. Take a look at "Re-assigning an activity to a specific participant"

    1. Thanks a lot for the Info Tiensoon, will have a look at that.

      1. Hi Tiensoon,

        My testcase is slightly different from the one you explained in the above url you provided, its like I need to assign the approver itself dynamically based on some condition.

        For example, as you mentioned in the claim form, If the Claim amount submitted is less then 10$ I would be assigning it to a particular approver/participant, and if its above 10 and less than 25$ I would assign it to the next level approver/participant and so on, this needs to be done dynamically and hence we went for developing a custom plugin, Could you please let us know whether any api method or any other way assign the approver/participant dynamically?

        Appologize that I didnt mention this condition part earlier.

        Thanks,

        Vignesh

        1. Hi there,

          You will just need to develop a custom participant beanshell plugin on this. You can do all the computation and logic in the beanshell itself and then finally return an array of username of type String for the activity's assignees.

          Good luck.

          1. Hi Hugo,

            Do you have any reference/documentation for Participant plugin, if so could you please share the same?

            Thanks,

            Vignesh

            1. Hi Vignesh,

              You may want to take a look at the discussion at A replacement for the HOD. I put some coding in there already.

              Good luck!

              1. Hi Hugo,

                I just wrote a custom participant beanshell plugin (DynamicUserMapping.java) which will simply fetches all the users available in the directory manager and added that to a collection and then returned it from the plugin.

                I have designed my workflow (dynamicUserWF.JPG) in such a way it will have 2 participants with a requestor and approver, for the requestor I just mapped it to one of the user as participant and for the approver I have added a tool which is mapped to the above mentioned plugin to fetch the users and return the array of users and another activity in the same which will approve the request (assignee for this activity should be the users returned by the plugin).

                But when i ran the process, the user is not getting assigned dynamically (but it is able to fetch the User details), instead the activity is going to the inbox of the Requestor itself (in my case it should be assigned to all the users).

                Kindly let me know whether Im missing something here or your comments if any.

                Thanks,

                Vignesh

                1. Hi there,

                  You should put our coding at Participant Mapping -> Map to Plugin -> Beanshell Plugin instead and not as a tool's plugin.

                  Hope it helps!

                  1. Thanks a lot Hugo, it worked!!! :)

                    Regards,

                    Vignesh

                    1. Hi Hugo/Tiensoon

                      Is it possible to develop a custom participant plugin instead of having to write code snippet in the beanshell plugin. We are planning to integrate workflow with an external application that we are developing and planning to map the participants in the external application. So we need to do the following tasks

                      1) Retrieve/Get the various activities in the workflow in the external application we are developing and do the participant assignment. If yes which API's we need to use to retrieve the list of activities available for the particular process.

                      2) Create a custom participant plugin which passes the parameters like participant name, process instance ID, process id to the .Net webservice and get the participants assigned in external application and assign the same to the specific workflow activity.

                      We want to do this so that the end users can create their own workflow without the need to write any java code and use the same custom participant plugin for various activities.

                      Thanks,

                      Vaidhy

                      1. Hi Hugo/Tiensoon,

                        I tried creating a custom plugin class and incorporated the same code as that of BeanShellPlugin and still no action is happening. I hard coded the actual java code snippet in the code itself to test it and even the BeanShellPlugin did not work with that. It is always expecting the input from text area only.

                        However, I am not sure why the custom plugin is not even working even after providing the java code in the textbox. Can you please help?

                        Thanks,

                        Vignesh

        2. Hi Vignesh,

          What you have described here should be part of the workflow design itself. I usually define different participants for the different group of approvers. Coming out from a new form submission, the workflow would then have to go through a route that will decide (based on the claim amount) which approval activity (one for each participant) that the process will flow to.

          The point of using workflow diagram is to clearly show how the business rules decides who approves what. Even if your decisions are made based on multiple rules, I would still suggest you define the participants clearly, with an approval activity at each level. You could still use a plugin to 'evaluate' the multiple rules that you may have, and come up with a YES or NO assigned to a workflow variable, that the workflow engine can evaluate. This makes your workflow design much clearer and easier to maintain in the long run.

          I hope I read you correctly and that this helps.

          Sam