- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2024 01:54 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2024 02:05 AM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2024 02:05 AM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2024 02:27 AM
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"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2024 02:34 AM
Hi @Anurag Tripathi ,
I have removed current.update(). It is working now.
Thank you so much!!
Thanks,
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2024 02:35 AM
At what point are you getting the error? Saving the record or when assignment group is populated?
Can you show a screenshot?