The CreatorCon Call for Content is officially open! Get started here.

script help, need to remove role

Gemma4
Mega Sage

Hi everyone,

I have a catalog ui policy script that was working perfectly today and then got a new requirement. The previous requirement was that if a variable additional information was yes (after the initial submition of the request) then any user with role pm_user would be required to answer additional required variables after the initial submit of the request. Attached is a copy of the script and when to apply.

Today I was asked to still follow all the requirements above, but to make the variables required for ALL users and not just those with the role. I've tried many variations in my script to remove the role or add not but nothing is working. Any ideas or suggestions?

thanks in advance for any feedback you have!

scriptwhen.PNGscriptgj.PNG 

7 REPLIES 7

Vishal Birajdar
Giga Sage

Hi @Gemma4 

 

You can write new Ui policy with same condition as above and make the variable mandatory using Ui policy action.

As new requirement does not require to check the role then no need to write script.

Just by using Ui policy and Ui policy action it will be achieved.

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Hi @Vishal Birajdar 

Thank you so much for all the feedback. I feel like we are so close to having this resolved. Let me give a little history in what I have done; in case it helps determine the root cause of why this not working. 

I created an order guide that utilizes a catalog item. Users with pm user role previously would  submit the request. Now the business is asking that all users have the ability to submit the request.

After the request is submitted, the manager (user with pm role) will selects Yes at additional information if more details are needed for the request.  If the manager selects Yes the additional fields do not need to be required for the manager to complete but the user that submitted the request. As a result I was unable to utilize a basic UI Policy/action because the fields were then required for the manager to complete. That is why I utilized two roles, one for the manager and one for the user that needed the variables required. Unfortunately now I can't get my script to work because it is making the variables required for the manager. 

 

 

Hi @Gemma4 

 

In that case you can create & run separate UI policy which will run specifically on option selected.

highlighted in below screenshot.

 

VishalBirajdar7_0-1695177766931.png

 

1.Create first UI policy which will apply only on catalog form

Applies on Catalog form : will apply only on portal/native UI before submission

 

2.Create second Ui policy which will apply only on RITM and change the logic

Applies on requested item : will apply only on RITM after submission

 

 

 

 

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

I'm confused. The user does not have ITIL access so they would need these fields required on the portal after additional information is yes from the platform?