How to check both Read only and Mandatory in Variable in Record Producer?

Daemon5
Tera Expert

How to check both Read only and Mandatory in Variable in Record Producer?
What scripts should I put in Default Value?

 

Any help would be appreciated.

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@Daemon5 

Should it be when form loads or based on some variable change?

When form loads -> onLoad catalog client script

When variable changes -> onChange catalog client script on that variable

Nothing to do with Default value. Default value is used to auto-populate variable when form loads

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

@Daemon5 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Daemon5 

 

You can do via catalog UI policy but either make it read only or mandatory at a given point of time.

 

LearnNGrowAtul_0-1703073038157.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron
Tera Patron

@Daemon5 

Should it be when form loads or based on some variable change?

When form loads -> onLoad catalog client script

When variable changes -> onChange catalog client script on that variable

Nothing to do with Default value. Default value is used to auto-populate variable when form loads

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you so much for the information.
I would like to set Read Only and Mandatory when Form load in Catalog client script.
I have tried the following script, but it only executes ReadOnly.
````
function onLoad() {
g_form.setReadOnly('fieldsname', true) && g_form.setMandatory('fieldsname', true);
}
````
Sorry for being a newbie, any suggestions on how to improve the script?

Thank you so much for the information!
 
I would like to set Read Only and Mandatory when Form load in Catalog client script.
I have tried the following script, but it only executes ReadOnly.
````
function onLoad() {
g_form.setReadOnly('fieldsname', true) && g_form.setMandatory('fieldsname', true); 
}
````
Any script improvements would be helpful!