Remove Option is not working in Ritm/Sc Task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 01:33 AM
Hello Community,
I need a remove a choice of variable of a variable set, so i written on load client script g_form.removeoption() and removed the variable choice, but it removed the option from service catalog, but when a requested is created i am still able to see those options in ritm/sctask , how to remove those options on ritm/sctask.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 03:24 AM
Surely, this is not the entire code? There are typos and if it's applied every time on load, why do you even have a script in the first place?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 03:34 AM
@James Chun I have a variable set which is used in many catalog items in that i have variable with 6 choices. So now my requirement is i want to hide 2 choices and add two new choices for a particular catalog only so now i used catalog onload client script used remove option to hide both options and also used addoption two add new choices by making applies on ritm/sctask true in script...now when creating a record i didn't see the options removed but when a record is created i am able to see the new options as well as removed options in sctask/ritm. the above code is exactly same i used. may g_form api is not working in sc_req_item, sc_task .i tried with g_sc_form also but it also did not worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 05:24 AM
hi @Dr Atul G- LNG , Can you please help me with this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 11:06 AM
Hi @sireesha19
Sorry for delay in response. Could you please share some screens what and where you need this.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 10:11 PM - edited 03-11-2024 10:13 PM
Issue can be resolved by using this.
add this below code helped in onLoad catalog client scripts and used form.removeOption instead of g_form.removeOption.
var form = typeof g_sc_form != "undefined" ? g_sc_form : form;
after writing above code use form.removeOption Instead of g_form.removeoption Eg:form.removeOption('variable', 'choice');
by using this we can hide the options in sctask/ritm and catalog form also.