Enable blocked asynchronous 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 >

Enable blocked asynchronous activity

Overview

To enable a blocked asynchronous activity, you should use the CHelper function called EnableAsynchExecution. This function takes the id of the asynchronous activity you wish to enable as a parameter.

 

CHelper.EnableAsynchExecution(long idAsynchWorkitem)

 

The following attributes is needed:

idAsynchWorkitem: id of the blocked asynchronous activity you want to enable.

 

Example

In this example, the function enableAsynchExecution will be used to enable a blocked asynchronous activity.

The expression would be as follows:

 

EnableAsynchExecution01

 

The code of the image is as follows:

var dtAsyncWorkitems = CHelper.GetAllStuckAsyncWorkitems();

for(var i=0; i < dtAsyncWorkitems.Rows.Count; i++)

{

   var idAsynchWorkitem = dtAsyncWorkitems.Rows[i]["idAsynchWorkitem"];

   var radNumber = dtAsyncWorkitems.Rows[i]["radNumber"];

   var idCase = dtAsyncWorkitems.Rows[i]["idCase"];

   var idWorkitem = dtAsyncWorkitems.Rows[i]["idWorkItem"];

   var tskDisplayName = dtAsyncWorkitems.Rows[i]["tskDisplayName"];

   var wfClsDisplayName = dtAsyncWorkitems.Rows[i]["wfClsDisplayName"];

   var awCurrentRetries = dtAsyncWorkitems.Rows[i]["awCurrentRetries"];

   var awCreationDate = dtAsyncWorkitems.Rows[i]["awCreationDate"];

   var awLastProcessDate = dtAsyncWorkitems.Rows[i]["awLastProcessDate"];

   var idWfClass = dtAsyncWorkitems.Rows[i]["idWfClass"];

   var idApplication = dtAsyncWorkitems.Rows[i]["idApplication"];

   var idOrg = dtAsyncWorkitems.Rows[i]["idOrg"];

   var ancestorPath = dtAsyncWorkitems.Rows[i]["ancestorPath"];

   var idTask = dtAsyncWorkitems.Rows[i]["idTask"];

   var lastErrorMessage = dtAsyncWorkitems.Rows[i]["lastErrorMessage"];

   if (awCurrentRetries >= 4)

   {

       CHelper.EnableAsynchExecution(idAsynchWorkitem);

   }

   if (awCreationDate.AddDays(5) >= DateTime.Now)

   {

       CHelper.EnableAsynchExecution(idAsynchWorkitem);

   }

}


Last Updated 5/23/2024 3:05:36 PM