- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2023 10:20 AM
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.
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 06:54 AM
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.
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 06:54 AM
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.
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 09:49 AM
All is correct on mine too, backend value of closed skipped too. Though, I can still see the state choice on other tasks unfortunately
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 10:02 AM
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);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 10:16 AM
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 😑
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 10:32 AM - edited 02-23-2023 10:32 AM
@cicgordy Seems solution works for you their might be some environmental mistake.
Please accept or mark it helpful if it works!