This article discusses the complexities of creating a ticket (request/incident/problem) through a pre-defined template
Service Desk Manager/CMDB 12.9 or higher on Windows/Unix/Linux
It is not possible to leverage the native functionality of the templates with creating a ticket through REST. That functionality being the fields and other pertinent data that are contained in the template is automatically copied over into the new ticket.
Comparing with the webengine/web interface and REST web services:
The following is a workaround one may try to follow to create a ticket through a template via REST. It is a manual process which simulates the activity across several REST calls. The overall procedure obtains the given fields from the template and the original ticket that the template is based off of, then creates a new ticket based on those values.
Unlike the webengine based functionality, REST will not automatically transfer any omitted field data from the template to the new ticket. If the summary field is left out, this method will not populate the field automatically from the source template. The summary field data needs to be populated as part of the REST call to create the ticket.
"@id": 12345,
"@REL_ATTR": "cr:12345", <== THIS IS THE ACTUAL TICKET ID which is the template
"@COMMON_NAME": 55,
"link": {
"@href": "http://SDM-SERVER:8050/caisd-rest/cr/12345",
"@rel": "self"
}
"@id": "U'XXXX'",
"@REL_ATTR": "U'XXXX'",
"@COMMON_NAME": "TestCI",
"link": [
{
"@href": "http://SDM-SERVER:8050/caisd-rest/nr/U'XXXX'",
"@rel": "self"
},
{
"@href": "http://SDM-SERVER:8050/caisd-rest/har_serx/U'XXXX'",
"@rel": "extension"
}
]
},
"assignee": {
"@id": "U'YYYY'",
"@REL_ATTR": "U'YYYY'",
"@COMMON_NAME": "ServiceDesk",
"link": {
"@href": "http://SDM-SERVER:8050/caisd-rest/agt/U'YYYY'",
"@rel": "self"
}
},.........................
"in": {
"customer": {
"@COMMON_NAME": "ServiceDesk"
},
"base_template": {
"@REL_ATTR": "cr:12345"
},
"affected_resource": {
"@COMMON_NAME": "TestCI"
},
"assignee": {
"@COMMON_NAME": "ServiceDesk"
},--------
In the above, steps 1 and 2 are gathering information about the template and the original incident which the template is based off of. Step 3 is where you need to populate all of the values from Steps 1 and 2, including the summary and description fields and any other fields which need to transfer across from the template. The webengine was designed to perform this task automatically per its design. REST, being that it is operating on an object basis, does not have the ability to leverage the webengine to perform the field data transfer. Simply specifying just the "base_template" attribute in the REST call in step 3 will not result in field data transfer from the template, as one would find in webengine.
Further, the resultant incident created via REST will not have the Initial Activity Log entry that reads as "Create request from template 'XXXX'". The initial activity log will simply read as "Create a new request/incident/problem/change/issue".
Sample-376694.json attached to this KB Article illustrates the above functionality. You can use a 3rd party REST testing product such as Postman to test.
Broadcom Support is not permitted to assist in developing any custom code. The attached code and the above document is provided as-is for reference and is not intended for use in a production instance. Please try the above in a testing instance.
SOAP Web Services supports the creation of a new incident via template, and functions the same as the webengine functionality. Please see how to create an incident from an existing template