Need to prevent a catalog task from closing when certain variables are not anwered.

allentschumper1
Tera Contributor

Hello -

Currently I am trying to do something I haven't done in the past.  have a colleague who has created a catalog item and a new workflow and on one of the TASKs in the workflow, they want it to be stopped from being Closed Complete if certain parameters are not met.

 

What I am finding is that when I try to do a business rule, it appears it evaluates the RITM and TASK concurrently and thus, the BR "works" but works in a way that is not what we are trying to achieve.  Instead of being able to just make a setting in a variable and then hitting Close Task (UI Action) or set state to Closed Complete and hit save...first you have to make your selection in the variable, then Save and THEN try to move it to Closed Complete and save and THEN the business rule works successfully.  

 

Hope I am wording this correctly.  It looks like since you are making the change on the TASK on a variable, when you try to change the state to Closed and save, it looks at the RITM as well...since that is not update/saved, the values there are different from that of the TASK and thus, the business rule putters out.

1 REPLY 1

jMarshal
Mega Sage
Mega Sage

I think I understand this correctly...the variable is on the RITM (mandatory) and the task isn't looking there for it's own required fields...so you can close the task, which tries to "roll up" the RITM, but fails, due to a mandatory field on the RITM being blank. You're then left with a closed task and an open RITM (needing user input before it can be closed, which needs to now be done fully manual).

If I understand this correctly, it's not "easy". I would recommend adjusting the UI Actions to support this. Perhaps supplementing with a client script.

You will want to force the end user to use the "Close Task" UI Action, rather than manually selecting "closed - complete" and then using "Save" (or submit or insert or insert and stay)...this way you can force ServiceNow to go look at the RITM for the variable in question, which returns an error with instructions to go fix the RITM before closing the task.

You can also "get fancy" with a client script that removes (hides) "closed complete" from the choice list unless the value on the RITM is appropriate...and/or you could make it an availability condition on your UI action.