g_form.removeOption not working on the Agent Workspace

hassaanazha
Tera Contributor
I am trying to remove and Option from the State field, the below code is working as required on the Native UI but when I switch over to the Sercurity Incident Workspace this function is not removing the Option from the state dropdown. The option that I want to remove has a value of 3 and a DisplayValue of 'Closed'.

function onLoad() {
   
  g_form.removeOption('state', 3);
}


hassaanazha_0-1743753812333.png

hassaanazha_1-1743753908131.png

 

 


5 REPLIES 5

swapnali ombale
Kilo Sage

hi @hassaanazha 

 

Looks like you are using the remove option with the labels, can you try the same with value?

I am using the value not the label, the 3 here is the value not the label.

 

In your client script uncheck global checkbox & select view name as "agent_workspace" then it will work in agent workspace view.

Ankur Bawiskar
Tera Patron
Tera Patron

@hassaanazha 

it should work.

Are you sure your client script is marked as Global=True so that it works in all views including workspace?

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader