How to make a field on Catalog task editable based on the variable value?

Saai1
Tera Expert

Hello,

 

I have a checkbox type field on the catalog task table and I want to make that editable only when the variable request type value is  xxx.

 

Any advice on how to do this?

 

Thanks,

1 ACCEPTED SOLUTION

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Please write a onload client script and all the below in the client script:-

 

 var value = g_form.getValue('varibalename')

       if (value=='whatevervalueyouwanttomatch'){

              g_form.setReadonly('fieldname',false);

       }

 

Please mark my answer as correct based on Impact.

View solution in original post

7 REPLIES 7

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @Saai1 ,

use catalog UI policy to handle this scenario.


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

If I write a catalog UI policy, how to get the filed on catalog task ?

DrewW
Mega Sage
Mega Sage

So you have a variable that is on some catalog items and not on others that you want to use to drive the visibility of a field on the catalog task table?  If so I think your only option is an ACL that uses a script.  Something like:

 

//This will need to be update
answer = (function(){
   if(current.variables.MYVAR && current.variables.MYVAR == "SOMEVALUE"){
      return true
   } else {
      return false
   }
)();

Community Alums
Not applicable

Hi @Saai1,

 

You can achieve this using catalog client script. However, if you are writing a Catalog client script or UI policy on task table, then it will be applicable globally. So, what is your exact scenario? Is the field Read-only at the moment and why is like that?

 

Regards,

Gagan k