Notification Approval

Poorva Bhawsar
Mega Sage

Hi Community,

 

I have a new state specific to a catalog item. I want to hide this new state, it should only be visible to a catalog item. Once this state is selected, it should trigger an approval to a group. If approved, need to change the state of the server ci from inbuilt to active. All SC tasks attachments needs to attach on the ci selected on the form.

 

I have this client script to hide this new state.

 

function onLoad() {
    var item = g_form.getValue('cat_item');
    if (item != 'a60987578739a514aa3574497bbb3533') {
        g_form.removeOption('state', 5);
    }

}
But its hiding this state option for all catalogs. I want to show this for a specific catalog item.
12 REPLIES 12

Anil Lande
Kilo Patron

Hi,

To hide this additional option only for specific cat item you need to create on Load client script.

It will hide state option as soon as form is loaded. 

Use only below part in your onLoad client script.

 

 var item = g_form.getValue('cat_item');
    g_form.getValue('state');
    if (item == 'a60987578739a514aa3574497bbb3533') {
        g_form.removeOption('state', 5);
    }

 

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

I have modified it to this.

function onLoad() {
    var item = g_form.getValue('cat_item');
    if (item == 'a60987578739a514aa3574497bbb3533') {
        g_form.addOption('state', '5', 'Pending Approval', '4');
    } else {
        g_form.removeOption('state', 5);
    }
}
 
But its still showing that dropdown option for all.

Hi Poorva,

Script is used on RITM table or some other table? Also, can you try adding alerts() at required steps to understand which of if/else condition is being satisfied.

It is in global scope for SCtask table. I have a new dropdown option for state for a particular catalog item.