Controlling the reaction to updates to PD tickets reflected back to ServiceNow

Hi, we have recently implemented auto-ticketing integration from ServiceNow to PagerDuty based on a custom incident use case in ServiceNow. Everything is working as expected, and the webhook is updating the ServiceNow incidents when PagerDuty incidents created by the API are updated. Our Ops team is now requesting to NOT resolve the ServiceNow incident when a responder in PagerDuty resolves the PagerDuty incident, in web or mobile. I have been looking at the documentation and it looks like i need to use an Event Rule under Configuration. I will do some testing in non-prod. Is there any previous use case where this has been done? Can it be done for all incidents or by user? TIA, Tim

Tim - you would need to handle this within ServiceNow by customizing the PagerDuty application or making other ServiceNow configuration changes to prevent this from happening.

1 Like

Hi Tim,

Thanks for writing into our help forum. To address an early part of your question, there is no way to differentiate where an incident was resolved from. So if your requirement is to prevent resolves that originate from web or mobile, but to allow resolves that originate from an API, that isn’t possible.

However, with our ServiceNow integration it is possible to ignore all resolve messages, or to get a bit more granular with which resolves are honored and which are ignored. This is something that will need to be done by writing custom code. You can see the code that processes incoming webhooks (sent from PagerDuty to ServiceNow) by looking at the PdWebhookTransform Script Include in ServiceNow.

Please be advised that all customizations of this nature are not supported by the PagerDuty Support team. Proceed with these changes at your own risk.


Hi Scott, thank you for the tip! I see where to go in the Script Include to make the adjustment. I will post back here when I am successful but it looks to me that you have pointed me in the right direction. In my test I just ran I see all the proper log messages for this section of the Script include. Thanks very much. Tim

Hi Tim,

I’m happy to hear that’s working out for you. Looking forward to seeing what you’ve built.

Hi Scott, I have confirmed through testing that your advice was good. Near the end of the incident.resolve section of code in the script include, I have commented out setting target.state and replaced it with a log message for future support. Thanks again for the assist. Tim

		// 2020-09-22 T. Reid Comment this out to stop PD incident being resolved from resolving the SN incident
		if (!taskHelper.isTaskHasResolvedState(target.state)) {
		//	target.state = taskHelper.resolvedStateValue();"Transform: PagerDuty incident was resolved, XYZ policy is bypassing setting incident {0} to resolved state", target.getDisplayValue());

Before making changes to any PagerDuty ServiceNow App script, please be sure to do an “Insert and Stay” on the original file keeping the exact same name and make your customizations in that file only. Set the original file to active = false. This will prevent any issues during future store based upgrades. Additionally, using update sets between each environment makes this process easy to promote into your production environment.