We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to set the variables READ ONLY once the SCTASK is closed?

Zhane Lising
Giga Contributor

How to set the variables READ ONLY once the SCTASK is closed?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

Hi,

create normal client script on sc_task table

Ensure you give correct catalog item sysId

function onLoad(){

	var ritm = g_form.getReference('request_item', callBackMethod);

}

function callBackMethod(ritm){

	if(ritm.cat_item == 'your catalog item sysId' && g_form.getValue('state') == '3'){
		g_form.setVariablesReadOnly(true);
	}

}

Regards
Ankur

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

View solution in original post

2 REPLIES 2

Jaspal Singh
Mega Patron

Hi,

 

You can follow link for the same. Just ensure you use the When To Apply conditions in UI Policy according to your Closed complete state.

Ankur Bawiskar
Tera Patron

Hi,

create normal client script on sc_task table

Ensure you give correct catalog item sysId

function onLoad(){

	var ritm = g_form.getReference('request_item', callBackMethod);

}

function callBackMethod(ritm){

	if(ritm.cat_item == 'your catalog item sysId' && g_form.getValue('state') == '3'){
		g_form.setVariablesReadOnly(true);
	}

}

Regards
Ankur

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