How to make business rule revert a field value?

jas101
Tera Expert

Hi guys, we want to use a simple abort business rule to prevent certain (RITM) records being assigned to certain groups.

This is working fine and is showing a message but we are wondering how we can make it so the Assignment group value reverts back to what the original value was (instead of  showing the group they've selected that they're not allowed to assign to)?

Many thanks.

1 ACCEPTED SOLUTION

Elijah Aromola
Mega Sage

Put in your code 

current.fieldname = previous.field_value; 

This will revert it back to the previous value.

 

If this resolved your question, please mark this as solved!

View solution in original post

3 REPLIES 3

Elijah Aromola
Mega Sage

Put in your code 

current.fieldname = previous.field_value; 

This will revert it back to the previous value.

 

If this resolved your question, please mark this as solved!

Many thanks for that.

I had to also code the abort action (below if anyone needs it) instead of using the 'Abort action' check-box to allow me to see/use the script box.

current.setAbortAction(true);

Harsh Vardhan
Giga Patron

did you try to use previous object in your business rule?

assuming here the business rule is before or after so you can use previous object. 

 

https://developer.servicenow.com/app.do#!/lp/new_to_servicenow/app_store_learnv2_scripting_madrid_bu...