Execute Activity

<< Click to Display Table of Contents >>

Navigation:  Low-code Process Automation > Studio Cloud - Authoring environment > Bizagi Studio > Process wizard > Business Rules > Business Rules examples > Cases and activities >

Execute Activity

The PerformActivity function is used to execute an activity. It is the equivalent of pressing the NEXT button, but it can be used remotely (from another case o activity) and providing information related to the activity.

 

The syntax of this function is:

 

CHelper.PerformActivity(XML_ActivityInfo)

 

The main parameters of this function is the XML in a string. This XML must contain the following information:

Domain

User name

Task Id

Id Case, to perform the action.

Work item id

Entities, with the information intended to be inserted into the task.

 

Thus, the XML structure shown below must be provided:

 

 <BizAgiWSParam>

         <domain>domain</domain>

         <userName>user</userName>

                 <ActivityData>

                         <taskId>taskId</taskId>

                         <idCase>"+casenumber+"</idCase>

                         <idWorkItem>"+WorkItemId+"</idWorkItem>

                 </ActivityData>

                 <Entities>

                         <XPath XPath=\"+entityXpath+"> value </XPath>

                 </Entities>

 </BizAgiWSParam>"    

 

The PerformActivity function is found in the Process category.

 

SetActivity1

 

Example

In an Client information update process, if the client does not have beneficiaries, the process must continue without registering them in parallel.

 

SetActivity2

 

We want to continue with the process flow specifying that the client has no beneficiaries, thus, the check mark control in Register Beneficiaries must be set as false.

 

To configure the activity when exiting, create a new expression closing the event Client Registration.

 

SetActivity3

 

The Activity Name, is RegisterBeneficiaries.

You can verify the name in the Activity properties of the Task by going to first step of the Process Wizard.

 

 var casenumber = Me.Case.Id
 var caseInfo = CHelper.getCaseById(casenumber);
 var workItems = caseInfo.getCurrentWorkItems();
         for (var i = 0; i< workItems.Count; i++){
                 if (workItems[i].Task.Name == "RegisterBeneficiaries"){
                         var WorkItemId= workItems[i].Id;
                 }
         }
 var XML = "<BizAgiWSParam>"+

        "<domain>domain</domain>"+

        "<userName>admon</userName>"+

        "<ActivityData>"+

                "<taskId>79</taskId>"+

                "<idCase>"+casenumber+"</idCase>"+

                "<idWorkItem>"+WorkItemId+"</idWorkItem>"+

        "</ActivityData>"+

        "<Entities>"+

                "<XPath XPath=\"SuscriptionProcess.Beneficiaries.hasBeneficiaries\">false</XPath>"+

        "</Entities>"+

        "</BizAgiWSParam>";
 CHelper.PerformActivity(XML);

 

Save the expression. When you select NEXT in the activity Client Registration, The activity Register Beneficiaries will continue its flow and the attribute hasBeneficiaries is now false.


Last Updated 11/10/2022 9:17:20 AM