Duplicate tasks getting generated for same RITMs after migrating from workflow to Flow

SumajRajNk
Tera Contributor

Hi Team

 

The workflow attached to a catalog item in PRODUCTION was migrated to FLOW... Now duplicate Tasks are getting generated for already generated RITMs which got generated previously at the time when Process Engine was not migrated to Flow i.e. when it was in workflow!

 

What would be the reason behind this? How can I solve this? Solutions for this issue are highly appreciated!

#flow #workflow #tasks #catalogitem

12 REPLIES 12

pratikjagtap
Giga Guru

Hi @SumajRajNk ,

 

This happens because of :

  • In sc_req_item, the field wf_activity_set may still reference the old Workflow context.
  • Flow doesn’t check for previous task generation unless you build a guard condition.
  • Migration doesn’t auto-disable legacy workflow triggers.
  • Some scheduled jobs or approvals might re-trigger flows.

 

Try following steps :

1.Prevent Flow from Running on Already Workflow-Handled RITMs
Add a Run Condition or If-condition at the top of your Flow to check if the RITM has already been processed by the old workflow:

current.wf_activity_set.nil() // TRUE only if it's not workflow-based

 

2.Mark Existing RITMs as "Completed" or "Flow-Processed"
You can mass-update existing RITMs (via script or fix script) to avoid re-triggering flows:

 

var ritms = new GlideRecord('sc_req_item');
ritms.addQuery('cat_item', 'YOUR_CATALOG_ITEM_SYS_ID');
ritms.addQuery('state', '!=', 'Closed'); // or whatever logic makes sense
ritms.query();
while (ritms.next()) {
ritms.u_migrated_to_flow = false; // or set a custom flag
ritms.update();
}

 

3.Double-check Triggers
Go to the Flow Designer and check:

Is the Flow trigger set to run on update or create?

Does it rerun on field changes? You may want to limit it to RITM creation only.

 

4.Retroactive Tasks?
If old RITMs already have duplicate tasks created, you’ll need to clean them up:

Identify duplicate SCTasks by RITM → count > expected tasks

Use created timestamps, approvals, or task states to identify which were generated by Flow vs. Workflow

Manually or via script, close/delete the unneeded ones.

 

If my response helped, please hit the 👍Thumb Icon and accept the solution so that it benefits future readers.

 

Regards,
Pratik

Shivalika
Mega Sage

Hello @SumajRajNk 

 

This should not happen, flow is something that cannot be reversed or re-triggered from any specific point. New flow should only be triggered for new RITMs and not existing ones unless you are manually testing it by giving specific RITMs then it can happen. Otherwise, itself it will never happen. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

@Shivalika 

What would be the reason behind this? How can I solve this?