Incident business rule to change state from custom state to Resolved

Nolan3
Mega Guru

I am trying to figure out how to create the business rule on the incident table that will change an incident from a custom inactive state (SLA value = 52) to resolved.  This is to be able to attach an SLA record to an incident that goes from New to resolved.

I was following this post https://community.servicenow.com/community?id=community_question&sys_id=26ee07a1dbdcdbc01dcaf3231f96...but I am unable to get the Attach SLA BR to do what I need in our dev instance.

We are running Kingston patch level 7

Here is what I have for settings.  Note the first business rule for moving the incident to my custom inactive state named SLA value 52 is working as expected. 

I then try to run another BR to take any incident that has a state of 52 and move it to resolved, this is the part that is not working for me. 

BR Name: Attach SLA
When: After insert
Order: 1,000 (have tried 905, 1001 and 2000)
Condition: current.incident_state == 52
Script:
current.incident_state = 6;//sets to resolve state
current.update();

Troubleshooting notes:
If I set the SLA state to active and then set the conditions on the business rule not in a script this works like it should.  However I don't want the state SLA to be viable which is why I was trying to do the script option on an inactive state.

I have turned on debug mode but doesn't seem to be giving me any useful information as to why this BR is not running.

Any help you can provide would be appreciated.  
Thanks,

Nolan

1 ACCEPTED SOLUTION

Mark Stanger
Giga Sage

If you change it to a 'before' business rule and remove the 'current.update()' from your script does it work?  You really don't want to use 'current.update()' in a business rule because it will cause duplicate updates (which will then cause duplicate event triggers, duplicate history entries, etc.  Because of this, any update to the current record should be done in a 'before' business rule so you can remove 'current.update()'.

View solution in original post

4 REPLIES 4

Mark Stanger
Giga Sage

If you change it to a 'before' business rule and remove the 'current.update()' from your script does it work?  You really don't want to use 'current.update()' in a business rule because it will cause duplicate updates (which will then cause duplicate event triggers, duplicate history entries, etc.  Because of this, any update to the current record should be done in a 'before' business rule so you can remove 'current.update()'.

Thank you Mark appreciate the help!  Changing the BR to Before and remove the current.update() solved my issue, it is now working the way I want it.

 

SanjivMeher
Kilo Patron
Kilo Patron

It should be an Before Update BR.

 

Also I am not sure, what are you trying to do using that BR. Instead you should have a UI action, clicking which it should move to Resolved state,


Please mark this response as correct or helpful if it assisted you with your question.

Hello Sanjiv,

 

thanks for the reply.  We do have a UI action for moving incidents to resolved but in this case I am trying to move incidents that would normally go from New to Resolved (like a password reset over the phone) to a inactive state so that the incident will then get a TASK SLA attached to it and be tracked in SLA reporting.

 

The comment from Mark above solved my issue.

 

Thanks