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

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.



If you are viewing this from the community inbox you will not see the correct answer button.   If so, please review How to Mark Answers Correct From Inbox View.



Thank you


m_m
Tera Contributor

OK this was very helpful Chuck.



Changing the Order field value to 1,000 on my Before Business Rule makes invoking the web service and correctly populating values on my task record work, based on the following Business Rule condition:


!current.assignment_group.nil() && current.assignment_group.changes()


and even on:


!current.assignment_group.nil() && current.assignment_group.changes() && current.assignment_group.name == 'external support group'


Reversing the business Rule Order field back to 100 stops it from working.



What still isn't working is the use of changesTo(). So, where as the above conditions both work the following doesn't:


!current.assignment_group.nil() && current.assignment_group.changesTo('external support group')


or


!current.assignment_group.nil() && current.assignment_group.changesTo(gs.getProperty('x_63815_table.external_group'))


Is there an issue with changesTo()?


The method is fine. You are using it with a named group. assignment_group contains a sys_id as it is a reference field.



You need to get the sys_id of that group and use it like this:



!current.assignment_group.nil() && current.assignment_group.changesTo('49e06a70db1222002e38711ebf9619a8'); // Use your group sys_id here



You might also consider this:



!current.assignment_group.nil() && current.assignment_group.getDisplayValue() == 'external support group'


m_m
Tera Contributor

Thanks Chuck for all your help.


Based on your advice, the solution I finally settled on is:



Before Business rule with the notable Order field value of 1,000.


BR Condition: !current.assignment_group.nil() && current.assignment_group.changesTo(gs.getProperty('x_63815_table.external_group'))


Changed the value in my System property category (gs.getProperty('x_63815_table.external_group') to the sys_id of the assignment_group required.


This makes the changesTo() bit work.


This now all works as required now.


Thanks


I'm glad you got your question answered. Thank you for participating in the community.