How to create re-useable Activities?

How to create re-useable Activities?

  

Hi,

I'm facing some problems regarding Activities. Here I explain the problem and all possible approaches that I've thought of till now due to which the post becomes too long. Thanks for reading.

I am trying to create Activities which take predefined inputs and return some outputs. I want these activities to be able to be reused again inside other processes at a later time (like maybe create a new Process and drag few predefined Activities into it as per your requirement to create a Process flow).

The problem occurs because activities don't exist on their own (they need to be inside an already defined Process). Because of this, I tried few alternatives:

  1. First Approach: I thought of creating a Process and then define all the required Activities inside it. So whenever you need to create a new Process Flow, create a Process and copy the activities(using Ctrl + C) from the first Process and paste it wherever required in the new Process. This way, I am using the first process only for holding my re-useable Activities and no actual instance of that Process is ever run.
    Problem: By using this method, if in future the definition of an Activity changes, I'll need to change it at all the places where that Activity is copied.
  2. Second approach: I thought of defining all the re-useable Activities by keeping one Activity inside one Process. This way whenever I need to reuse an Activity, I call LaunchProcess action of the Process containing that activity.
    Problems:
    i) If my Process flow contains 20 Activities, that'll mean I'll be Launching 20 Process instances one after the other from a single Process.
    ii) Using this method, I can't make sure that the first Activity inside a process finishes before the second activity in that process is started (since processes are run asynchronously). So, it might create problems if my first activity has an output parameter to be used as an input in second activity.
  3. Third approach: I thought of creating one Action Logic for each re-useable Activity inside the Logic tab in Service Studio. So whenever I need to reuse an Activity, I create a Process, then drag a new Automatic Activity from left panel and then place the required Action Logic inside that Automatic Activity.
    Problem: It only solves the problem for Automatic Activities. This way I'll still have to configure the properties (in bottom right properties panel) for human activities and wait statement.

    Currently I'm following the 3rd approach, but need to find out a way to minimize the configurations that need to be done after design of re-useable components is done.

    Please suggest some way for this (and thanks for reading it till last! :P)

Hi Mandeep,

I assume you are using BPT.

In BPT you can create processes and sub-processes, which means that you can put subprocesses in processes and in those subprocesses you can place the activities.

In this way you can follow the main process, execute the activities in the subprocesses and even have the same subprocess be executed inside the main process, but with different input-parameters and this can then result in a different sub-process flow when you use if's in the sub process or process.

I hope this helps, otherwise give me a real-life example of a process you want to create and I might be able to help you with an example eSpace with this process.

Hi Remco,

Thanks a lot for your reply and sorry that I couldn't reply for a long time.

Yes, I'm using BPT.

I'm not sure what exactly you mean by sub-process. I think you mean it as a new process which is Launched from the main process using LaunchProcess action of the sub-process.

With this, your solution follows the 2nd approach of my post. The only difference is that I was placing only 1 activity inside each process but you are suggesting me to put multiple activities inside a process. This approach has some problems that I don't know the sequence in which the activities have to be executed and hence I may not require the activities to be executed in the sequence in which they are defined in the process.

Regarding the processes, you can just consider them to be having normal logics inside them.

Please let me know if you need any other detail.

Thanks,
Mandeep

Hi Mandeep,

You don't need to call the LaunchProcess action. You can place the two sub processes in the same main process. Below you see the very small example of such a process with twice the same sub process, but with different inputs.

If this is not helping you, can you send a more extensive desciption of your problem?

Kind regards,

Remco Dekkinga