- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2018 07:34 AM
I'm trying to trigger a subflow from the RITM workflow, this subflow will create a catalog task and nothing else.
I get everything to work properly with the following code, the workflow is triggered and the task is created and the correct values are set based on the script in the create task activity
var ritm = current.getUniqueValue();
var seq = '';
var gr = new GlideRecord('u_sequence');
gr.addQuery('u_request_item', ritm);
gr.addQuery('u_active', 'true');
gr.orderBy('u_sequence');
gr.query();
while(gr.next()){
if(!seq){
seq=gr.getValue('u_sequence');
}
if(gr.getValue('u_sequence') == seq) {
//Trigger the Workflow related to the Resource
var wf = new Workflow();
var context = wf.startFlow(gr.u_resource.u_workflow, current, current.update());
}
}
The workflow is triggered as expected and when I fulfill the task being created the workflows ends.
Now to the problem:
I'll later in the same workflow trigger the same workflow once again, and this is where the problem starts.
The workflow itself triggers and I reach the Create Task activity, but no task is being created the second time and nothing in the script field on the Create Task activity is being executed.
Can't you trigger the same workflow twice and let it create a task?
The values on the task will be completely different since we get all the information in the task based on the sequence table.
I tried triggering 2 different workflows (doing the exact same thing) and in that case it worked as expected.
My problem is I don't want to create hundreds of workflow doing the same thing, it'll be a mess to maintain in the future.
This is the table where I pick up what workflow to be triggered (a reference to wf_workflow table)
Solved! Go to Solution.
- Labels:
-
Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 05:10 AM
Think I found the reason for this. It seems like you can't use create task activity if you want to reuse the same workflow twice from an item. You'll have to script the task creation instead to get it to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 05:10 AM
Think I found the reason for this. It seems like you can't use create task activity if you want to reuse the same workflow twice from an item. You'll have to script the task creation instead to get it to work.