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

Variables readonly in sctask once form is Saved

wefw
Tera Contributor

Hi,

We have few decision making variables in sctask with type yes/no. can we make them readonly once that variables are filled and sctask is saved?

 

Thanks

1 ACCEPTED SOLUTION

@wefw 

then check if variable is empty or not

Something like this

AnkurBawiskar_0-1738060748008.png

 

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

Ankur Bawiskar
Tera Patron
Tera Patron

@wefw 

yes you can use onLoad catalog client script which applies to catalog task and set them readonly

g_form.setReadOnly('variable1', true);

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

but when we use onload client script, then before entering any value that field will be readonly right?

i need to make readonly once the value is entered in that variable and after saving the form

Community Alums
Not applicable

hi, you can put a validation before making it as read only. just validate if it's empty or not. if it's not empty then make it read only

@wefw 

then check if variable is empty or not

Something like this

AnkurBawiskar_0-1738060748008.png

 

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