Setting value of reference fields using Business Rule

tyagisu
Mega Expert

Hello!

I am trying to set some fixed values in reference fields like assignment group, location, primary configuration item. Our requirement is when incident tickets are generated from Dynatrace Integration, assignment group, location and CI should have the values X,Y and Z auto set. I tried using onLoad client script to set up these values, but it didn't work as expected. The onLoad script would work only after opening the tickets, hence I thought of using Before Business Rule.

We cannot set these values in Integration script itself because of some other requirement conflicts.

Here is my script:

(function executeRule(current, previous /*null when async*/) {
current.contact_type = "X";
current.location = "Y";

current.assignment_group = "Z";
current.update();
})(current, previous);

Any help would be highly appreciated!

Thanks,

Su

1 ACCEPTED SOLUTION

Do you have group by name Z in your sys_user_group table. Please pass the exact name of group. Write before insert/update BR.

EX: Network is a group name

current.assignment_group.setDisplayValue('Network');

View solution in original post

9 REPLIES 9

Yes

Shweta KHAJAPUR
Tera Guru

If you want to set it by it's name then you can make use of  below function or else you can set it by sys_id

setDisplayValue("Z");

current.assignment_group.setDisplayValue("Z"); this didn't work. 

Do you have group by name Z in your sys_user_group table. Please pass the exact name of group. Write before insert/update BR.

EX: Network is a group name

current.assignment_group.setDisplayValue('Network');

Thanks a lot!

It worked 🙂