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

Cheers from another Alok,

Check the log first, If the sys_id is coming in log then you should change your script as 

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

 

Alternative, if nothing works, 

You can write a after update Business rule with very high order(i.e. 10000 or  12000). In this case you need to twist your code a bit as below:

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

 

Kindly mark my answer correct/helpful if I was able to help you in anyway.

Regards,

Alok Das

Cheers Alok 🙂

I have tried the solution provided by you but not working.

The issue is there is already an assignment rule which is auto populating the assignment group with a different group based on a different condition. My script is not able to over write the group already set. 

Regards,

Alok sahu

why are you using script here, as i had mentioned this requirement can be solved without writing a single line of code. 

you  just need to add the filter condition. 

set the filter condition like below. 

 

product | IS | ActixOne  

AND

feature | IS | Mobile Back

 

Now go the action tab in your business rule and set assignment group name which you want to set. 

 

It's Simple way , give a try. 

Note: You have already checked "Insert" checkbox so this business rule will only for new Record .

 

 

 

Hi Harsh,

I tried your provided solution but not working.

 

 

might be you are missing something here,, 

may i know you are testing it while creating a new record . 

 

can you share the record screenshot as well as business rule which you have written .