How to make variable mandatory only after approval has been given and task created

kdelbridge
Tera Expert

I have a request on a new catalog item for one of the variables to only be visible at the RITM  / SCTASKs  level.

  • the variable will actually be completed during TASK 1

I am trying to figure out a way for this variable to NOT be mandatory until AFTER the approval has taken place and the catalog task has been created.

 

Once the 1st catalog task is created, this variable needs to be visible and editable so it can be filled in as part of completion of task one. 

 

 

Any assistance anyone can offer will be greatly appreciated.

5 REPLIES 5

Dinesh Reddy By
Kilo Sage

Hi @kdelbridge 


You can follow the below steps to achieve the requirement

 

  1. Create the following Catalog UI Policies:

    • Hide the variable on the catalog item form.

    • Make the variable visible and read-only at the Requested Item (RITM) level.

    • Make the variable visible and mandatory at the Catalog Task level.

  2. Add the variable to the Catalog Task -  variable list in the associated flow.

Thanks,

Dinesh

Please accept the solution and thumbs up if it is helpful

 

kdelbridge
Tera Expert

this is a start, but the requirement is for the variable to be editable at the RITM  level as well as the catalog task  level and it needs to be mandatory.  

Zach N
Tera Guru

There are likely a few ways to solve this, but a quick and simple method would be to create a hidden and ready-only variable (through UI policy) on your catalog item named something like "Item Approved." Once the requested item is approved, you can set this variable to "True" in your flow, and then create a UI Policy where Item Approved is True, and make sure both Applies on Catalog Tasks and Applies on Requested Items are checked, and Applies on a Catalog Item view is unchecked.

 

If you're comfortable with scripting, you could also create an onLoad() client script and check the value of the approval variable and then set the field mandatory/not mandatory based on that value. In my PDI the approval variable has the same name on the RITM and SCTASK so a single script should be all that is needed (make sure that this only runs on the SCTASK/RITM just like the UI Policy above).

 

Also, remember to not set the variable as mandatory on its definition, otherwise client scripts and UI policies will have no effect on it.

 

Hope that helps! Let me know if you need some examples of either method.

kdelbridge
Tera Expert

@Zach N , I would love to see an example. I am trying to wrap my head around trying to set the "item approved" variable to "true" in my flow.

 

I am  still learning my scripting.