make Requested by variable Readonly for End users

prasad39
Tera Contributor

Hi All, 

 

I have requirement like,

I have a 'requested by' varaible Reffering to user table, Currently this variable is editable for all the users. users is asking 'requested by' variable is editable only for 'ITIL' role users for other users it should be Readonly. Can any one help me on this.

 

Thanks, 

Prasad 

1 ACCEPTED SOLUTION
5 REPLIES 5

Anil Lande
Kilo Patron

Hi,

One way is to make it readonly at Variable configuration level.

Screenshot 2024-01-18 at 6.52.49 PM.png

Or use OnLoad client script to make it readonly.

you can use below logic:

 

 

if(g_user.hasRoleExactly('itil')){
g_form.setReadonly('requested_by',false);
}else{
g_form.setReadonly('requested_by',true);
}

 

 

 

make sure there is no UI Policy making it Mandatory or editable.

 

Not applicable

Yup, these are the top 2 ways I'd use - if it was me , I'd surely go with Permissions config, as it's easier to do and maintainable by SNow. 
I have a massive catalog performance issues exactly due to large catalog scripts, which were growing over the years and now it's total pain to rework the cat items... I was thinking this can happen only on purpose, but there are items giving timeout or best taking like 30+ seconds to render - rootcause => too many catalog client scripts where more than a half could be avoided using OOB functionality. 
Just sharing my recent experience, not saying one should not use those. 🙂
Cheers,
Joro

Not applicable

If this is for catalog variables (I got it this way) - you can open the catalog variable definition in question (requested_for) and use Permissions functionality :

JoroKlifov1_0-1705584970489.png