Business Rule Condition not working

m_m
Tera Contributor

The following condition works when the assignment group value selected from the assignment_group drop down list is 'Maintenace':

current.assignment_group.changes() && current.assignment_group.getDisplayValue() == 'Maintenance'

However, this condition does not work when the same 'Maintenance' value is autopopulated via an assignment rule

Further, this condition was used in replacement for my original condition (!current.assignment_group.nil() && current.assignment_group.changesTo(gs.getProperty('table.external_group'))) because I couldnt get that to work. The issue appears to be the use of the function changesTo().

Can anyone help please?

1 ACCEPTED SOLUTION

Check the order field on your business rule. There is some coordination between assignment rules and business rules you should be aware of.


Check section 1.2.1 here



http://wiki.servicenow.com/index.php?title=Defining_Assignment_Rules#Precedence_between_Assignment_R...


View solution in original post

19 REPLIES 19

m_m
Tera Contributor

Going forward, then the only solution is to use what I have?



!current.assignment_group.nil() && current.assignment_group.changes() && current.assignment_group.getDisplayValue() == gs.getProperty('table.maintenance.external_group')


As long as it's not an async BR, you're find using changes(), changesTo(), and changesFrom().



Async business rules have no concept of the 'previous' object os they don't have anything to compare to.


I should have included this earlier...



Reference:


Business Rules - ServiceNow Wiki


Business Rules Best Practices - ServiceNow Wiki  


Looks okay but I don't remember if .changes() works or not with Async.


I would try to add a log in the script and check if that condition actually works or not.


m_m
Tera Contributor

This condition definitely works in an async Business Rule:


!current.assignment_group.nil() && current.assignment_group.changes() && current.assignment_group.getDisplayValue() == gs.getProperty('table.maintenance.external_group')



I get to successfully consume my web service, and update my task ticket work_notes and correlation_id fields. The ecc queue has an entry and using gs.info shows me the values I am consuming.