How do I show state choice "closed skipped" on sc_task table ONLY for 1 c item and hide for others?

cicgordy
Tera Guru

How do I show the state choice "closed skipped" on sc_task table ONLY for one catalog item in particular called "hardware request" and hide all the others ? I don't want other catalog items to have this state choice.

 

cicgordy_0-1677003460165.png

I have tried UI policy with a condition "item is "hardware" but I am struggling with script. Any help with script or any other way to achieve this? 

 

Any help will be appreciated, thanks.

1 ACCEPTED SOLUTION

@cicgordy ,

 

This is a tried and tested solution in my PDI and it works for me perfectly fine... check my attached solution which I have tested in my PDI. Might be you are missing something. Make sure that what is the backend value of "close skipped" in your instance.

PRINCE_ARORA_0-1677163990868.png


If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

View solution in original post

14 REPLIES 14

@cicgordy ,

 

This is a tried and tested solution in my PDI and it works for me perfectly fine... check my attached solution which I have tested in my PDI. Might be you are missing something. Make sure that what is the backend value of "close skipped" in your instance.

PRINCE_ARORA_0-1677163990868.png


If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

All is correct on mine too, backend value of closed skipped too. Though, I can still see the state choice on other tasks unfortunately

@cicgordy 

 

Thanks for the update!
Just make sure the sys_id, which you mentioned in the code should be of catalog item not of the RITM, please check below code I have added the alert, sys_id found in alert(for Hardware request cat item) should be same as if condition.

function onLoad() {
g_form.getReference('request_item',Myfunc);
function Myfunc(response){
alert(response.cat_item);
if(g_form.getValue('short_description') != "Hardware approval" && response.cat_item + "" != "SYS_ID_OF_CAT_ITEM"){
g_form.removeOption('state',7);
}
}
}

 

The sys id was correct, and it matched the alert one.

The state doesnt show in other catalog items, but shows in other tasks of the "hardware" item. 

I cant understand the reason why actually 😑

@cicgordy  Seems solution works for you their might be some environmental mistake.

 

Please accept or mark it helpful if it works!