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

Make Variables on associated sc_task editable when RITM when RITM is Open

sarthak92
Tera Expert

HI Champs, Need your help. There is a requirement to make certain variables visible and editable on associated task for catalog item till the time the RITM is open. Once the RITM is closed, the variables on task should be read only. These variables should only be visible and editable on task and should not be visible on catalog Form /RITM. Tried using UI policy but not able to fetch this functionality completely. variables on task are still editable even after RITM is closed. Ideally no one should be able to edit those variables once associated RITM is closed/cancelled. Please help. Thanks.

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@sarthak92 

Now here there are 2 requirements

1) Show certain variables only on SC Task and not on RITM form

a) For this you can create Catalog UI Policy with Onload checkbox as true

b) Set Applies on Requested Item -> true

c) Make the variables as Visible -> False from the Catalog UI Policy Actions

This will ensure those variables are hidden on RITM form

2) Make certain variables editable only on SC Task when RITM is Open/Pending/In Progress

a) For this you can use Catalog client script

b) Applies on Catalog Task -> True

c) Script below

function onLoad(){

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

}

function callBackMethod(ritm){

if(ritm.state == '3' || ritm.state == '4' || ritm.state == '7'){
g_form.setVariablesReadOnly(true);
}

}

Regards
Ankur

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

Thanks. Tried this but with above menthod, the particluar variable is going to read only even when the RITM is work in progress.. Variable is not visible on form/ritm and visible on Task so this is working as expected. only issue is it is still read only in task. ideally it should be editable. are we missing something on UI policy ?

Hi,

So visibility is working fine.

Are you using catalog client script or UI policy to make the variables read-only for Closed RITM

what is not working

Regards
Ankur

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

using client script as you suggested.. visibility is working fine.. how can I make the variable editable on task as all the variable are read only on task when RITM is open.