Social

mandag den 24. februar 2014

Template IDs, the "safer" way to build criterias

Many criteria is based on work item titles in conjunction with other properties. Often the title is the defining property for the criteria, ex. Title equals "Grant employee access to system" and Status equals "In progress". This title is not exactly unique and could easily be repeated elsewhere.
Maybe the title needs to be changed in the template, but tens or hundres of work items based on the current form of the template is still dependant on a criteria mathing their exact title, and you would need to change the title for all of these (using PS!).

The solution: Extend your favorite work items with a single field: "Template ID", or simply use existing extension properties. In this field you enter a unique ID and use this as criteria for your workflow/subscription/view/whatever. It can even be used in a PS Filter

You can use the PS snippet below to generate a GUID (it is placed in the clipboard by piping to clip)

[guid]::newGuid().tostring().replace("-","") | clip

edit:
All templates have an ID which is definde in the MP containing the template. Look for <ObjectTemplate ID="....". This ID is carried into the instance of Runbook Automation Activities to the property TemplateId - check for yourself using powershell or simply in the history tab. Service Requests also have a property TemplateId but the template ID (from xml) is not carried into the instance of the SR template unless it is a default service request, one would have to manually edit the xml to do this.

Ingen kommentarer:

Send en kommentar

Søg i denne blog