- 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 04:21 AM
"Hardware approval" is the short description.
"Hardware request" is the name of the catalog item.
I want the "close skipped" state choice to appear/show ONLY when catalog task "Hardware approval" creates (therefore only for "Hardware request" item on that particular task)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 04:37 AM
@cicgordy ,
Please write a on load script on the "sc_task" table as mentioned below:
function onLoad() {
g_form.getReference('request_item',Myfunc);
function Myfunc(response){
if(g_form.getValue('short_description') != "Hardware approval" && (response.cat_item).getDisplayValue() != "Hardware request"){
g_form.removeOption('state',7);
}
}
}
Could you please try this and let me know if it works for you!
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 04:51 AM
Thanks for this, but not working sadly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 05:01 AM
@cicgordy ,
Can you try this, I believe getDisplayValue is not working in client side, can you just change the logic as mentioned below
instead of name of the catalog item just update the sys_id of the catalog item and try it once if it works or not!
( && response.cat_item + "" != "SYS_ID_OF_CAT_ITEM")
function onLoad() {
g_form.getReference('request_item',Myfunc);
function Myfunc(response){
if(g_form.getValue('short_description') != "Hardware approval" && response.cat_item + "" != "SYS_ID_OF_CAT_ITEM"){
g_form.removeOption('state',7);
}
}
}
Please try this and let me know if it works!
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:41 AM
nothing, it doesnt work! so frustrating