Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

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

 

 


6 REPLIES 6

It is marked as Global, but still its not working

AlecBrouillette
ServiceNow Employee

The options for the state field are controlled via the process definition ootb code for SIR. What I think is occurring in your situation is that the OOTB client script "sn_si_incident state process" has an AJAX call which is overwriting your g_form.removeOption() once it completes since it is slower.

We do not recommend editing the process definitions and code, however if you do decide that this change is necessary there are potentially 3 options. 

 

1. Edit client script sn_si_incident state process's return function to include your requirements regarding state

2. Edit the existing process definitions script include to align with your vision (don't recommend)

3. create a completely custom process definition (I would duplicate an existing one to make minor edits of as to not miss anything critical)


Relevant code to look at:
Client Script:
sn_si_incident state process

Script Includes:

sn_si.ProcessDefinitionAjax
sn_si.ProcessDefinition

sn_si.ProcessDefinition_NIST_Open

sn_si.ProcessDefinition_NIST_Stateful

sn_si.ProcessDefinition_SANS_Open