Servicely Capability
Templates
9 min
within servicely it is possible to create templates can be used for two main purposes these purposes include the ability to pre set records on a record based on hardcoded values or values (such as making a record a priority 1, setting an assignment group and classification (and more)) or create a record based on a schedule (such as a monthly security patch task) currently these are only definable by system administrators (as they can be script) and are global for agents on that record type regardless of the purpose however, you will still need to create the system template definition to be used in both circumstances template definition when creating a template, one of the first steps is creating a template to do this, you can go to either the templates list, or create a new template directly, as found in the administration menu, under the templates section (you will notice there are some out of box examples there for some administrative purposes) once you are there, you can start creating your template definition with the following details true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type system template values to allow a system template to set the fields on the table described above below are the fields and their definition and how they can be used true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type system template value examples as templates can be used for a variety of purposes, we have provided some examples as to what to set fields to achieve certain purposes example 1 hardcoded values for fields in situation where you want to set a field to a “hardcoded” value (such as an assignment group to a specific value, priority to a specific priority, short description to specific text) and more to achieve this you would want to advanced no (false) value this will be dynamic based on what type of field some examples are for choice fields this needs to be the choice key you can find out the choice key by looking at the field definition and the field specific settings tab such as, for priority it wouldn’t be “1 critical” the template value would be “1” or for source, it wouldn’t be “phone”, it would be phone for reference fields this would be the id of the reference record for string fields it is simple the string you want to use example 2 parameterised values from scheduled templates the way parameters are passed in will be described in the “scheduled templates” section, however, to achieve this you would want to advanced no (false) value the parameter name will be done within ${} noting that the parameter is specifically passed in via the scheduled templates section, which will be described below example 3 scripted values the third example is scripted values as this is server side scripts, you can do lookups, look at the record to template values and more what we have typically found with customers is using this for a templated response and replacing it with items like the requestor’s name to achieve this, you would advanced yes (true) script this is server side code it should be noted that you should review docid\ latfchaaxu1wqcrr1vn0p if you want more detail, but to help describe this, you can refer to fields on the current record and you should often check if values exist to help explain this, we have developed the example to provide this end result in this example, it takes the requestor’s first name and provides a html string, to make sure it is formatted correctly also, as described above, you want to make sure that the last item in the script is the variable, as pointed out below the reason as to why we have escaped some text here, is as the journal field is html, if we included braces, it would format it as html, so this ensures that in the template it would include the <> when the requestor does not exist you can also make use of parameters defined in a scheduled template’s context script, on a template value’s script, example below mapping to a multi reference field referencing the cmdb table below shows an example of a scheduled template’s context script returning the parameters to use on a template’s script shown above scheduled templates in addition to using templates from an agent point of view, templates can also be scheduled, which would take the template and its values and creates a record with that table name based on a schedule defined it can also take parameters from the scheduled template, to allow it to be more dynamic (such as if you want to script it) to create a scheduled template, go to the templates section under the administration menu item once here, you can populate the following fields to achieve what you want to achieve true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type