- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2020 08:38 PM
Am trying to change the status of A task ticket for example ( TASK12345) from open to close completed using inbound email action.
it will be one number or more that one on the email body, how the system will trigger that and do the action that we looking for?
Solved! Go to Solution.
- Labels:
-
Customer Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2020 07:37 AM
Ok, so target empty is expected because we are not expecting any new record to be created via this received email.
Any how if you can give me access or we can review all your code and configuration.
you can send me misra.ashish [at ] gmail dot com.
Thanks,
Ashish
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2020 09:02 PM
Hi,
Create a new inbound email action on sc_task table and match the subject line / OR / email body for TASK Number.
Based on incoming task number and well defined email pattern, Glide the sc_task table and get the same TASK and update the state value from open to close.
Thanks,
Ashish
Please mark correct answer/helpful for others if helps you.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2020 09:20 PM
Hi,
If you are updating ticket or your task based on the reply from email then you need to used inbound email action.
In Inbound email action you need to set the field like
Select the table- task
Action: Record Action
Type: Reply
In Actions you can write script or in condition specify task number is 'TASK12345'
Use below script in Action section:
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
var gr = new GlideRecord("task");
gr.addQuery("state", "open");//specify open backend value here
gr.addQuery("");//specify here more condition to update the same ticket
gr.query();
if (gr.next()) {
current.state = close; //specify close backend value here
current.update();
}
})(current, event, email, logger, classifier);
Please Mark correct/helpful answer if it help you in any way.
Thanks,
Kunal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2020 08:27 AM
The task # will be in the email body, like a list :
TASKxxx1
TASKxxx2
TASKxxx3
etc..
the script will close those tasks?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2020 08:51 AM
You have to define the pattern and trap that pattern to get all TASK number.
Make sure all such email should contain that same pattern to act on it.
E.g. If you are sending all Task Number in Email Subject Line using some delimiter ( ',' ) then read the subject line in Inbound Action and split the subject line and get all Task Number in Array. Later you are use while loop to search and update those task.
Use the below code in Inbound Action : Actions Tab
// If you are sending Task Number in Subject Line
var emailSubject = email.subject; // read the email subject line
var taskList = emailSubject.split(',') // where "," is delimiter
for(var i=0 l taskList < length ;i++){
var grTask = new GlideRecord('sc_task')
grTask.addQuery('number',taskList[i]); // get the TASK Record
grTask.addQuery('active', true) // check it task is active
grTask.query();
if(grTask.next()){
grTask.state = '3' // 3 is choice code for close completed in sys_choice table for sc_task.
grTask.update();
}
}
// If you are sending Task Number in Email Body
var emailBody = email.body_text; // read the email BODY
var taskList = emailBody.split(',') // where "," is delimiter
for(var i=0 l taskList < length ;i++){
var grTask = new GlideRecord('sc_task') // Table = sc_task
grTask.addQuery('number',taskList[i]); // get the TASK Record
grTask.addQuery('active', true) // check it task is active
grTask.query();
if(grTask.next()){
grTask.state = '3' // 3 is choice code for close completed in sys_choice table for sc_task.
grTask.update();
}
}
If you are expecting the same logic for new mail, REPLY ( RE: ) email and FORWARD ( FW: ) email then create the same inbound for all 3 cases.
If you have any script issue then put the gs.log () in script and test it.
Please let us know if it's working for you or some script issue. We will review and resolve it together.
Thanks,
Ashish
Please mark correct answer/helpful for others if it helps you.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution