Overview
JetPatch integration with ServiceNow supports dynamically updating Review Status and Review Notes fields based on Remediation Plan outcomes. This guide explains how to configure these fields and state transitions within ServiceNow to ensure accurate status reporting.
Supported Review Statuses
1. Successful
-
Review Status:
Successful
-
Review Notes:
All endpoints patched successfully.
2. Unsuccessful
-
Review Status:
Unsuccessful
-
Review Notes:
Patching Actions Applied: 0 Not Applied: 3000 Failed: 0
3. Partially Successful
-
Review Status:
Partially Successful
-
Review Notes: (Example)
Patching Actions Applied: 2317 Not Applied: 675 Failed: 51
Configuration Steps
Fields to Configure (intigua.properties
)
Ensure the following new properties are set correctly:
itsm.ticket.pg.close-code.field=close_code
itsm.ticket.pg.close-notes.field=close_notes
(Above values are default)
Also, configure the custom fields in ServiceNow (replace u_review_status
and u_review_notes
with actual field IDs as appropriate):
itsm.property.variables=u_review_status,u_review_notes
Handling Cancelled Remediation Plans
JetPatch sends the word "Cancelled" in the close_notes
field when a remediation plan is cancelled.
Updating State Transitions in ServiceNow
Modify the ChangeRequestStateModel script to handle cancellations based on Close Notes:
Example Script:
closed: {
moving: function() {
return this.toClosed_moving();
},
canMove: function() {
return this.toClosed_canMove();
}
},
toClosed_moving: function() {
var closeNotes = this.getCloseNotes();
if (closeNotes && closeNotes.toLowerCase().includes('cancelled')) {
return this.moveToCancelled();
}
return true;
},
moveToCancelled: function() {
this.state = 'cancelled';
return true;
},
getCloseNotes: function() {
// Actual logic to retrieve Close Notes field
return this._gr.getValue("close_notes") || '';
}
Example modification for "Draft" state:
draft: {
nextState: ["closed", "cancelled"],
closed: {
moving: function() {
return this.toClosed_moving();
},
canMove: function() {
return this.toClosed_canMove();
}
},
cancelled: {
moving: function() {
return this.toCancelled_moving();
},
canMove: function() {
return this.toCancelled_canMove();
}
}
}
Testing and Validation
After saving your script changes:
-
Transition tickets from various states to Closed.
-
Ensure that including "Cancelled" in Close Notes automatically transitions the ticket to the Cancelled state.
-
Verify Review Status and Notes fields reflect accurate results after each Remediation Plan execution.
Comments
0 comments
Please sign in to leave a comment.