Remove Option is not working in Ritm/Sc Task

sireesha19
Tera Contributor

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.

9 REPLIES 9

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?

@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.

sireesha19
Tera Contributor

hi @Dr Atul G- LNG , Can you please help me with this.

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]

****************************************************************************************************************

 

 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.