- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 02:42 AM
Hello!
We are trying to implement a system where we close an incident via email.
We want to read the subject that will contain the INC number at the beginning.
The script is,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 12:59 AM
Can you update the code as below and let me know please
grTask.state = 7;
grTask.close_code = "Workaround provided";
grTask.close_notes = "Closed from inbound action";
grTask.update();
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 11:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 12:21 AM
I redid the script and its like this:
(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
// Extract the first 10 characters from the email subject
var emailSub = email.subject;
emailSub = emailSub.substring(0, 10);
// Create a new GlideRecord for the 'incident' table
var grTask = new GlideRecord('incident');
// Add queries to filter records with the specified incident number and active status
grTask.addQuery('number', emailSub);
grTask.addQuery('active', true);
// Execute the query
grTask.query();
// Check if a record was found
if (grTask.next()) {
// Update the state of the incident to 'close completed' (7)
grTask.state = 7;
grTask.update();
}
})(current, event, email, logger, classifier);
Still it doesnt work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 12:21 AM
Have it resolved your actual issue if So please mark the solution as Accepted, if not lets discuss it further!
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 12:23 AM
@Prince Arora sadly no, Still it doesnt work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 12:27 AM
Can you please print the
var emailSub = email.subject;
gs.info("emailSub " +emailSub);
And trace it in system logs