- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hello,
I've been tasked with creating an incident ticket when a closed RITM receives an additional comment.
I created a flow to help satisfy this request as follows:
Trigger - Updated
Table - sc_request (sc_request_item was not available)
condition: additional comments changes
run trigger: once
Actions:
If state is closed complete
create incident (and specified all fields)
Is there a better way to accomplish this?
During testing my flow runs to create an incident even when a additional comments does not change.
Thank you for your time and review.
Solved! Go to Solution.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago - last edited 4 weeks ago
Hi @Beth19
May you try via Business Rule After > Updated
- Navigate to System Definition > Business Rules.
- Click New.
- Fill out the form:
- Name: Create Incident for Closed RITM Comments
- Table: sc_req_item
- Advanced: Check this box.
- In the When to run tab, set the following options:
- When: after
- Update: Check this box.
- Order: 100 (or a value that ensures it runs after other relevant business rules)
- In the Filter Conditions section, set the conditions to check for a closed RITM and an additional comment update:
- State is Closed Complete (or your equivalent closed state)
- Additional comments changes
- In the Advanced tab, paste the following script into the Script field:
// Exit if the additional comments field has not been updated by a user
if (current.comments.changes() && current.comments.toString() == previous.comments.toString()) {
return;
}
// Create new incident
var inc = new GlideRecord('incident');
inc.initialize();
// Set incident fields from RITM and new comment inc.short_description = 'Follow-up comment on closed RITM: ' + current.number;
inc.caller_id = current.requested_for;
inc.description = 'A follow-up comment has been added to a closed Requested Item. \n\n' + current.comments.getJournalEntry( 1 ); // remove spaces
inc.comments = 'Original RITM: ' + current.number;
inc.parent = current.sys_id; // Link the incident to the RITM
// Optional: map other fields as needed
// inc.assignment_group = current.assignment_group;
inc.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago - last edited 4 weeks ago
Hi @Beth19
May you try via Business Rule After > Updated
- Navigate to System Definition > Business Rules.
- Click New.
- Fill out the form:
- Name: Create Incident for Closed RITM Comments
- Table: sc_req_item
- Advanced: Check this box.
- In the When to run tab, set the following options:
- When: after
- Update: Check this box.
- Order: 100 (or a value that ensures it runs after other relevant business rules)
- In the Filter Conditions section, set the conditions to check for a closed RITM and an additional comment update:
- State is Closed Complete (or your equivalent closed state)
- Additional comments changes
- In the Advanced tab, paste the following script into the Script field:
// Exit if the additional comments field has not been updated by a user
if (current.comments.changes() && current.comments.toString() == previous.comments.toString()) {
return;
}
// Create new incident
var inc = new GlideRecord('incident');
inc.initialize();
// Set incident fields from RITM and new comment inc.short_description = 'Follow-up comment on closed RITM: ' + current.number;
inc.caller_id = current.requested_for;
inc.description = 'A follow-up comment has been added to a closed Requested Item. \n\n' + current.comments.getJournalEntry( 1 ); // remove spaces
inc.comments = 'Original RITM: ' + current.number;
inc.parent = current.sys_id; // Link the incident to the RITM
// Optional: map other fields as needed
// inc.assignment_group = current.assignment_group;
inc.insert();