Assignment group is not populating

Samiksha2
Mega Sage

Hi all,

I have written the below code in customer service application to populate the assignment group based on custom table.

Script include

 getAssignmentGrp: function() {
        user_array = [];
        var platform = current.parent_case.u_platform;
        var product = current.getDisplayValue('parent_case.product');
        var subproduct = current.getDisplayValue('parent_case.u_sub_products');
        //gs.log('GET ASSIGNMENT platform' + platform);
        //gs.log('GET ASSIGNMENT product' + product);
        //gs.log('GET ASSIGNMENT subproduct' + subproduct);
        var dee = new GlideRecord("u_sub_product");
        dee.addEncodedQuery('u_platform=' + platform + "^u_product=" + product + "^u_sub_product=" + subproduct);
        dee.query();
        if (dee.next()) {
            user_array.push(dee.u_default_group + '');
            //.toString();
        }
        //gs.log("GET ASSIGNMENT " + user_array);
        return user_array;


    },

 

Business rule on Before

	var assignment = new sn_customerservice.getPlatform();
	var returnVal = assignment.getAssignmentGrp();
	gs.info("Business rule " + returnVal);
	current.assignment_group = returnVal;
	current.update();

 I am getting the sys_id of the group in the logs. But it is not updating the assignment group in the sn_customerservice_task table.
I thought may be application issue so I did the same thing in the Global application but still it is not updating the assignment group.

Please help

Thanks,
Sam

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

You are returning Array form Script include, and then populating it on the field which can take 1 id only. Why is that?

Try this in the BR and see if that works

var assignment = new sn_customerservice.getPlatform();
	var returnVal = assignment.getAssignmentGrp();
	gs.info("Business rule " + returnVal);
returnVal =returnVal.toString().split(',');
	current.assignment_group = returnVal[0];
	current.update();

 

-Anurag

View solution in original post

5 REPLIES 5

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

You are returning Array form Script include, and then populating it on the field which can take 1 id only. Why is that?

Try this in the BR and see if that works

var assignment = new sn_customerservice.getPlatform();
	var returnVal = assignment.getAssignmentGrp();
	gs.info("Business rule " + returnVal);
returnVal =returnVal.toString().split(',');
	current.assignment_group = returnVal[0];
	current.update();

 

-Anurag

Hi @Anurag Tripathi ,

I am getting the assignment group but it is showing this error.
"Unique Key violation detected by database ((conn=1755142) Duplicate entry 'fe8bc34bc35892909cf8b24599013153' for key 'PRIMARY')
Invalid insert"

 

Hi @Anurag Tripathi ,
I have removed current.update(). It is working now. 

Thank you so much!!

Thanks,
Sam

At what point are you getting the error? Saving the record or when assignment group is populated?

Can you show a screenshot?

-Anurag