Add condition to client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 08:56 AM
Hi All,
I have 2 OOB client scripts - Variable Editor Readonly
on RITM and SC TASK table.
This is making all variables read-only on RITM and sc task.
Requirement is to restrict these 2 client scripts only to few catalog items. (where catalogs = Procurement).
How can i add this condition to the client scripts?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 09:07 AM
@dvelloriy In your client script Variable Editor Readonly on RITM you can check the following.
// Get the Catalog Item reference
var catalogItem = g_form.getReference('cat_item', callback);
function callback(catalogItem){
if (catItem.sys_id === '<sys_id of catalog item>') {
//Don't make the variables read only
}
else{
//Make variables read only
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 09:09 AM
Thanks Sandeep, There are multiple catalog items, however they are all pointing to 1 catalogs (Procurement).
Can we add item.catalogs in the condition?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 09:14 AM
@dvelloriy Yes, the catalog check will also work. This will eliminate the need to check each catalog item individually.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 09:10 AM - edited 08-01-2024 09:10 AM
Hi,
You can try to USe Display BR to set a scratchpad variable as below, This is on RITM.
if(curent.cat_item.sc_catalogsLIKE<sys_idOf Procurement catalog>)
//set a scratchpad variable
In your client script check for the scratchpad, if it is true then don't run the script and if it is null or false then run it.