Auto set of assignment group based on conditions not working.

Alok21
Giga Expert

Hi Team,

I am trying to auto set assignment group based on conditions but it is not working.

The requirement is while creating a new case if Product (Reference field to Product table)= 'Alokproduct' and Feature(Reference field to Product table) = 'Alok feature', then the Assignment group for that case should be auto Populated with "Case support group". I have created a before insert BR with below code. 

if(current.isNewRecord()){
var product = current.getValue('product');
var feature = current.getValue('u_feature');
if (product == 'Alokproduct' && feature == 'Alok feature'){
current.assignment_group = '9d55d96f292200da6f08c6eb3ee442'; 
}

}

Note: There is already an assignment rule which is auto populating the assignment group on a different condition. My condition is different and i want to over write the group when my conditions are satisfied.

Can someone please assist?

 

Regards,

Alok sahu




1 ACCEPTED SOLUTION

Community Alums
Not applicable

As the assignment rule you mentioned is already in place, you will need to keep this BR to overwrite it

because assignment rules trigger after the form is submitted.

 

If you still want the users to see the change client side(on the form) then additionally you will have to write 2 onChange Client Scripts.

1. for product field:

if(newValue == 'sys_id of Alokproduct' && feature == 'sys_id Alok feature')

g_form.setValue('assignment_group','9d55d96f292200da6f08c6eb3ee442');

 

2. for feature field:

if(newValue == 'sys_id of Alok feature' && product== 'sys_id Alokproduct')

g_form.setValue('assignment_group','9d55d96f292200da6f08c6eb3ee442');

 

Please mark as correct/helpful if this helps! 🙂

Thanks 

DR

View solution in original post

25 REPLIES 25

Community Alums
Not applicable

Hi,

 

You can create a business rule as such:

find_real_file.png

BR is insert true so it will only check for new record.

In conditions put Product is Alokproduct AND Feature is Alok feature

in Advanced tab write 1 line of script:

current.assignment_group = '9d55d96f292200da6f08c6eb3ee442'; 

also make sure the order of the BR is more than 1000 so that it runs after the assignment rule and overwrites it.

 

 

Please mark as correct/helpful if this helps! 🙂

Thanks 

DR

Hi,

Its working and setting the group, but only after i save the record. I want to auto populate before saving the record. How can we do this?

Regards,

Alok sahu

Community Alums
Not applicable

As the assignment rule you mentioned is already in place, you will need to keep this BR to overwrite it

because assignment rules trigger after the form is submitted.

 

If you still want the users to see the change client side(on the form) then additionally you will have to write 2 onChange Client Scripts.

1. for product field:

if(newValue == 'sys_id of Alokproduct' && feature == 'sys_id Alok feature')

g_form.setValue('assignment_group','9d55d96f292200da6f08c6eb3ee442');

 

2. for feature field:

if(newValue == 'sys_id of Alok feature' && product== 'sys_id Alokproduct')

g_form.setValue('assignment_group','9d55d96f292200da6f08c6eb3ee442');

 

Please mark as correct/helpful if this helps! 🙂

Thanks 

DR

Hi,

Can it be handled by a single client script?

 

Community Alums
Not applicable

Hi Alok, 

As you want the change to be displayed on form whenever the product AND feature fields have required values, the onChange scripts need to be written for both field.

I would also suggest you to add an extra line at beginning of both client scripts so that the assignment field resets when the conditions are not matching:

g_form.setValue('assignment_group','');