Put condition on Business rule and client script for incident state changes to change it onhold.

Ssinha4
Tera Contributor

Hi everyone,

We have to create a BR and client script for the requirement if user with no itil role nor the member of assignment group will change the state to onhold then they will get error message and abort the action. We need this on change of state and from list view also.

I tried to put entire condition on condition field but it didn't worked. Please find below:

 

1. current.state.changes() && current.state == 3 && current.assignment_group != null && !gs.getUser().isMemberOf(current.assignment_group.toString()) || !gs.getUser().hasRole('itil')

 

2. Write a bore BR with the below condition and script

 

Ssinha4_0-1747741337643.png

3. We have client script:

onchange client script:

 

 Ssinha4_0-1747742337626.png
       

               
 
Script Include:
Ssinha4_1-1747741695725.png

None of the approach is working for now.

 

Thanks if you can hel

 

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Ssinha4 

in the BR condition try this and then add logs and see where it's failing

current.state.changes() && current.state.toString() == '3'

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

getting gs.getUserID() as blank or undefined

Is the script include Client callable? 

yes