VMware Cloud Community
rdaka
Enthusiast
Enthusiast

Updating workflow attributes during execution

Hi,

I have a workflow that waits until a custom event takes place or reaches maximum time limit before going to the next item. I need to update the maximum time limit value while the workflow is running. I want to do this from another workflow when certain conditions are met.

To put it simply, is it possible to update attributes of a workflow instance from another workflow?

I have checked WorkflowToken object and do no see anything to perform an update operation. An help is appreciated. Thanks in advance.

Tags (2)
0 Kudos
4 Replies
iiliev
VMware Employee
VMware Employee

Hi,

Messing with the attributes of another workflow execution sounds like a bad idea to me.

Why not using some more conventional options to share configuration information, eg. using configuration element attributes? ConfigurationElement scripting class has useful methods to rad/write element attributes values.

0 Kudos
rdaka
Enthusiast
Enthusiast

Agree with you. Right now I am already working on the approach you have mentioned.

Meanwhile, do you know if the waitCustomEventUntil end time can be increased ?

System.waitCustomEventUntil(string , string , endDate)

0 Kudos
cloudyred
Enthusiast
Enthusiast

You might want to give some more details  of what you're trying to achieve. One alternative Approach is that you could leverage a message server and the amqp plugin to manage complex interactions between workflows.

0 Kudos
rdaka
Enthusiast
Enthusiast

Hi Cloudred,

We have a workflow that requests for IP address and waits for 40 minutes using waitCustomEventUntil. Refer to below code.

// Calculate custom event wait time

endDate = new Date();

endDate.setMinutes(endDate.getMinutes()+ 40);

eventType = "internal";

eventName = payload["machine"]["id"]

eventCustom = System.waitCustomEventUntil(eventType,eventName,endDate);

unpause= (eventCustom != null) ;

ipdns.JPG

When we receive IP address, we resume the above workflow using System.sendCustomEvent(eventName);

Request IP address workflow will wait until a custom event occurs with 'eventName'. Now we need to extend the end time of custom event to 2 hours while the workflow is waiting during the 40 minute timeframe in case of we see any errors.

Thanks.

0 Kudos