changesTo() function not working for a business rule.

Saumya Awasthi
Kilo Contributor

Hi, my business rule configuration is as below.

when to run - before insert, update

script: 

var type;

if(current.assignment_group.changesTo('abc'))

{

type = 2;

}

The assignment_group is a reference field on the table. The above piece of code is not running for me. 

I am trying to do something like this - current.Display_value_of_Assignment_group.changesTo('abc').

Can anyone please help in explaining if this is achievable and how changesTo() function work with reference fields. 

Thank you!

6 REPLIES 6

Mohith Devatte
Tera Sage
Tera Sage

hello @Saumya Awasthi ,

can you try with below format by giving the sys_id of the group record instead of name?

var type;

if(current.assignment_group.changesTo('sys_id_of_the_group'))

{

type = 2;

}

Hope this helps 

Mark the answer correct if this helps you

Thanks for your response, but according to the requirement, I do not want to use the sys id of the group. 

hello @Saumya Awasthi  then try to do this in the when to trigger it self like below instead of script 

find_real_file.png

Muhammad Khan
Mega Sage
Mega Sage

Try using this

if(current.assignment_group.getDisplayValue() == 'abc'){

}