Client script to make variables mandatory- after submit

Gemma4
Mega Sage

Hi everyone,

I am trying to make variables mandatory after the request has been submitted, if the user has the pmsubmitter rule and if a custom field additional information is set to yes. I'm attempting to do this with a client script (below and attached) . Below is the script I am trying and attached are the results. When I impersonate a user after the request has been submitted, with the pmsubmitter role the platform is showing a black * instead of red indicating the field is required. In addition, the user that submits the request needs to be able to show these variables as required on the portal after summitted and their manager selects Yes at additional information. Unfortunately the variables are not getting set as required on the portal. Is this possible? In the past I've utilized sctasks and a flow to achieve. Below 

 

Thank you in advance for any guidance you can provide!

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (g_user.hasRoleExactly("pmsubmitter"))

if (newValue === 'Yes') //yes
g_form.setMandatory('test1', true);
else
g_form.setMandatory('test1', false);
}clientscript.PNG

 

 Platform Required.pngportal not required2.PNG this but the requirement is to simply use the ritm for all the data. 

10 REPLIES 10

Peter Bodelier
Giga Sage

Why not use a Catalog UI Policy?
 Check these fields, and you should be good to go:

PeterBodelier_0-1694007783427.png

 


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.