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

@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

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!

Daemon5
Tera Expert

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 suggestions on script would be helpful.