Flow designer

William08
Tera Contributor

 Hi all,

 

For a RITM Mutiple Sc task is create now how to set the ritm state to closed incomplete if any of the Sc task state is closed incomplete similarly for closed skipped.

 

Thanks,

 

@Sonam Tiwari could you please help on this

3 ACCEPTED SOLUTIONS

Sonam Tiwari
Tera Guru

Hi @William08 ,

 

To you main flow you, you can add a subflow in the below manner and pass it the ritm record.

SonamTiwari_0-1690875499927.png
The subflow looks something like this

SonamTiwari_1-1690875557578.pngSonamTiwari_2-1690875577248.png


Initializing a flow var in second step so that futher in for each step we can track all the states of child tasks from which we then need to check if any one is closed complete or incomplete or skipped.

SonamTiwari_3-1690875646041.png



SonamTiwari_4-1690875658055.png

 

SonamTiwari_5-1690875669531.png

and so on.

SonamTiwari_6-1690875683707.png

I had to use bit of script because couldn't track all the child states at once to check one of them is in a specific state like (complete, incomplete or skipped).

Not always a good idea to do too much scripting in flows if not required. 

This is working fine for me. Please test once. 

Also as @sleepycrown  said, we have alternative ways to do it and BR is one of them as well. Like you can attach this subflow to any other flow with similar requirement, same way you can make use of BRs to have a common solution.

 

Thanks

View solution in original post

OlaN
Giga Sage
Giga Sage

Hi,

I would recommend setting the state in the Flow/Workflow based on the outcome of the SCTASK.

I believe it is considered bad practice to create custom business rules on the sc_req_item table, because there is so many other things going on in these tables concerning stages and states.
I've spent some time looking for a reference for this, but cannot find it at the moment (believe it was on the Docs).

View solution in original post

If you can provide reference that indicates it’s not a good practice to have BR on sc_req_item, I would appreciate it as I cannot find it either. I’ve never seen it mentioned nor from ServiceNow. There are plenty of baseline rules on many tables in the platform; with good run conditions and a concise script, there should be no issues. Empirically, I’ve not noticed any of my BRs on sc_req_item causing any performance impact and never shows up in long running jobs/processes. It’s also never showed up in my instance health reports from ServiceNow. 


I mean, this is what business rules are for…

 

 

A business rule is a server-side script that runs when a record is displayed, inserted, updated, or deleted, or when a table is queried.

Use business rules to accomplish tasks like automatically changing values in form fields when certain conditions are met, or to create events for email notifications and script actions.”
 

View solution in original post

8 REPLIES 8

Hi @Sonam Tiwari How shall we test this? I have tried this sub flow and my execution stops at 3 rd step with no output 

KSLNSAHITHI_0-1720013061794.png

KSLNSAHITHI_1-1720013078114.png

I have tested this with RITM and SCTask

OlaN
Giga Sage
Giga Sage

Hi,

I would recommend setting the state in the Flow/Workflow based on the outcome of the SCTASK.

I believe it is considered bad practice to create custom business rules on the sc_req_item table, because there is so many other things going on in these tables concerning stages and states.
I've spent some time looking for a reference for this, but cannot find it at the moment (believe it was on the Docs).

If you can provide reference that indicates it’s not a good practice to have BR on sc_req_item, I would appreciate it as I cannot find it either. I’ve never seen it mentioned nor from ServiceNow. There are plenty of baseline rules on many tables in the platform; with good run conditions and a concise script, there should be no issues. Empirically, I’ve not noticed any of my BRs on sc_req_item causing any performance impact and never shows up in long running jobs/processes. It’s also never showed up in my instance health reports from ServiceNow. 


I mean, this is what business rules are for…

 

 

A business rule is a server-side script that runs when a record is displayed, inserted, updated, or deleted, or when a table is queried.

Use business rules to accomplish tasks like automatically changing values in form fields when certain conditions are met, or to create events for email notifications and script actions.”
 

Might be I was mistaken, only reference I could find, was regarding manipulating Stage field.

 

As you described, a business rule that runs with precise conditions will minimize the risk of unexpected results, still my main concern was not the creation of a business rule by itself, but a business rule that changes states (and/or stages).

This can become unpredictable since there are many other OOB business rules and such that handle these fields.