in Service Manager

How to check if a Service Manager Notification Template is associated to a Workflow or Notification Subscription

Update: As Trang mentioned in the comments, the first version of the script only found templates which are assigned to a Notification Subscription. I updated the script to look for templates which are assigned either to a Workflow or Notification Subscription.
————————-

Sometimes I come across Service Manager environments which have a whole bunch of notification subscriptions and corresponding templates configured. Normally these environments are productive for some time and several changes have been made to processes and notifications.

Well, when changing and deleting workflow and notification subscriptions the corresponding template is mostly left behind. Maybe for good reason because people just don’t know which of their notification templates are referenced by other workflow or notification subscriptions. Since it is pretty awful to open the properties of every subscription in the Service Manager console to check whether it references a given template, I searched for a better way to find out whether a template is assigned to a workflow or notification subscription or not.

Find Notification Template Dependencies

Like in many situations, PowerShell together with SMlets is your friend Smile Since Notification Subscriptions are in fact workflows, we can check if a template is referenced in the WriteAction of a workflow. So what I do is to get all the workflow objects from Service Manager and check if their WriteAction contains a specific pattern which includes the given template GUID.

You can get the GUID of a template by using the template’s DisplayName and the following query:

Et voilà, you can find the PowerShell script I created below. You will need SMLet installed to be able to execute correctly. It is kind of a first draft and may be improved in some ways. Feel free to comment if you have any suggestions on how to enhance the script! Hope this helps!

Write a Comment

Comment