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

Kalaiarasan Pus
Giga Sage

How about this?



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


lorisd_avanzo
ServiceNow Employee
ServiceNow Employee

Try using the Filter Condition of the Business Rule form.



Filter Conditions.png



Then I believe the debugging tools may help you in order to check what is not working


http://wiki.servicenow.com/index.php?title=Debugging_Tools_Best_Practices#Debug_Business_Rule


m_m
Tera Contributor

Thank you both for your replies.



From what I can see now I have this working. When I posed the question, the BR was a "Before" Business rule. I have now used an async BR rule for invoking my Web Service and I am using var response = s.executeAsync();



This has allowed me to go as far as using the following code in my Condition:



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



This is working fine for new records and existing records. I just have to reload the page to see the update in work_notes and the value entered in the correlation_id field.



I just need to work out how to correctly use changesTo() to replace current.assignment_group.changes() && current.assignment_group.getDisplayValue(). Using changesTo(gs.getProperty('table.maintenance.external_group')) doesn't want to play ball.


changesTo won't work with async rule.