How do I trigger a workflow from a business rule?

Blair5
Tera Guru

We have an order guide and one of the items needs to wait for another item to complete. In the workflow for the first item, I am creating an event when the workflow completes. On the second workflow (the one that is waiting for the first) it is 'listening' for that event to queue. I've looked through the forums and see that to accomplish this, I need to write a business rule that would trigger the event on the second workflow.

I found this BR on another forum post:



fireWorkflowEvent();

function fireWorkflowEvent() {
var wf = new Workflow().getRunningFlows(current);
while(wf.next()) {
new Workflow().broadcastEvent(wf.sys_id, "b4d35f960a0a3cac011ac12fae09d514");
}
}


I've implemented this, however I'm not sure what I need to do for the workflow that is waiting. I currently have a "Wait for WF event" on it, but that isn't working. Does anyone know what I'm missing? Or - Can any one suggest a different way to approach this?

Thanks.

6 REPLIES 6

DubeyN
Mega Expert

Hi Guys,

It is possible to modify this UI action and trigger any workflow once user click the button(UI Action).

I have a requirement where user move the status to more information requested by clicking the UI Action button, my plan is to create a simple flow and run it when someone click the UI Action rather than create flow with all combinations.

Thanks in advance.

ND


Edmand
Kilo Explorer

I have the same problem getting the workflow event to fire. After some trial and error, I found out why, I was trying to fire the workflow event at the Request Task level but my workflow is at the Request Item level. I just substitute the 'current' with a gliderecord for the Item record and it start working for me. Hope this information help.