To make closed state value visible only when current state is review in SIR workspace

apurvab
Tera Contributor

Hi,


We need to make closed state value visible only when current state is review in SIR workspace. We tried using onChange client script as well as Before business rule but its not reflecting in workspace. Is there any other way to configure this? Is this needs to be done from UI builder and how?

 

Thanks.

1 ACCEPTED SOLUTION

AlecBrouillette
ServiceNow Employee
ServiceNow Employee

Hello Apurvab ,

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

View solution in original post

5 REPLIES 5

ankitbanerj
Tera Expert

Hello @apurvab ,
If this is a form in workspace normal client script/BR should work.
For UI Builder:
1. Take a label component and make it visible only when your criteria meets.
2. use a transform data broker script to use GR and compare with previous value which will return boolean.
3. based on that value make that label component visible.

Best regards,
Ankit B

If this solution worked for you, kindly mark it as Accepted Solution and give it a Helpful rating to support the community.

Hi @ankitbanerj ,

 

Thankyou for your reply. yes it is a normal form, but it is not working as expected in workspace by using client scripts and BR. We have a field 'state' with choices available on the form. In UI builder why do I need to create a new component? 

 

Regards,

apurva

Ankur Bawiskar
Tera Patron
Tera Patron

@apurvab 

in normal client script running on workspace you can't remove options from choice field using g_form.removeOption()

don't allow users to change the state i.e. make state field readonly and drive everything using UI action on form which when clicked moves the state to next value and show the correct UI actions on form based on condition

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Hi @Ankur Bawiskar ,

 

We are using SANS framework, in which we want analyst to be able to change states of SIR to any value as and when required expect when they want to close the SIR it should be in review state first. Is there any other way apart from UI actions on form for each state?

 

Thanks,

Apurva