Inbound action Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have an issue in CSM.
I have an inbound action on the Case table. Through this inbound action, I want to perform this on task of a case:
Update the Rejection Details
Update the Tracking Number
Change the State to Canceled
Update Assigned To based on whoever replies via the inbound action on a Case Task
I’ve also created a Business Rule to synchronize task details back to the case. just tell me script to update the details of task from inbound action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
hey @amirservice
You can achieve this requirement using an Inbound Email Action on the Case table and update the related Case Task using a GlideRecord query inside the script section.
Since the inbound action runs on the Case (current), you need to explicitly query the associated Case Task and update the required fields.
Script:
(function runAction(current, event, email, logger, classifier) {
// Query active Case Task related to this Case
var taskGR = new GlideRecord('sn_customerservice_task');
taskGR.addQuery('parent', current.sys_id);
taskGR.addQuery('active', true);
taskGR.query();
if (taskGR.next()) {
// Update Rejection Details
taskGR.u_rejection_details = email.body_text;
// Update Tracking Number (example: from email subject)
taskGR.u_tracking_number = email.subject;
// Change State to Canceled (verify correct state value in your instance)
taskGR.state = 7;
// Update Assigned To based on email sender
var userGR = new GlideRecord('sys_user');
userGR.addQuery('email', email.from);
userGR.query();
if (userGR.next()) {
taskGR.assigned_to = userGR.sys_id;
}
taskGR.update();
}
})(current, event, email, logger, classifier);
*************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
hey @amirservice
Hope you are doing well.
Did my previous reply answer your question?
If it was helpful, please mark it as correct ✓ and close the thread 🔒. This will help other readers find the solution more easily.
Regards,
Vaishali Singh

