How To Use SOAP Web Service API methods To Create An Incident As A Template
search cancel

How To Use SOAP Web Service API methods To Create An Incident As A Template

book

Article ID: 93268

calendar_today

Updated On:

Products

SUPPORT AUTOMATION- SERVER CA Service Desk Manager - Unified Self Service CA Service Desk Manager CA Service Management - Asset Portfolio Management CA Service Management - Service Desk Manager

Issue/Introduction

From web interface, an analyst can create an incident and set the template name/quick template type all on the same web page. However, this can't be done
using just createRequest() method only from soap web service API. createObject() would need with proper attribute values after the createRequest() call. This tech doc shows how this can be done.

How To Use SOAP Web Service API methods To Create An Incident As A Template

Environment

Service Desk Manager/CMDB 12.9, 14.1, 17.1 on Windows/Unix/Linux

Resolution

This is a two steps process:
1. call createRequest() method using type=I and template_name=the-template-name, along with other attributes
    for example
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:createRequest>
         <sid>1860911740</sid>
         <creatorHandle>cnt:CCF1B157F383BE4FB7FB29F26DEBC439</creatorHandle>
         <attrVals>
            <string>customer</string>
            <string>cnt:CCF1B157F383BE4FB7FB29F26DEBC439</string>
            <string>summary</string>
            <string>Example of template incident</string>
            <string>type</string>
            <string>I</string>
            <string>template_name</string>
            <string>exampleTemplate</string>
         </attrVals>
         <propertyValues>
         </propertyValues>
         <template></template>
         <attributes>
         </attributes>
         <newRequestHandle></newRequestHandle>
         <newRequestNumber></newRequestNumber>
      </ser:createRequest>
   </soapenv:Body>
</soapenv:Envelope>
Pleease notice that this will return the newRequestHandle and you would need this value in the next call.
2. call createObject() for cr_tpl object with template=newRequestHandle,template_name=the-same-temaple-name-as-step1, with proper quick_tmpl_type
    for example
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:createObject>
         <sid>1860911740</sid>
         <objectType>cr_tpl</objectType>
         <attrVals>
            <string>template</string>
            <string>cr:400613</string>
            <string>template_name</string>
            <string>exampleTemplate</string>
            <string>quick_tmpl_type</string>
            <string>0</string>
         </attrVals>
         <attributes>
         </attributes>
         <createObjectResult></createObjectResult>
         <newHandle></newHandle>
      </ser:createObject>
   </soapenv:Body>
</soapenv:Envelope>
Please notice that in this example, cr:400613 is the newRequestHandle from step 1 and exampleTemplate is the SAME as step 1. And for quick_templ_type,
this is the mapping:
0--Not a quick template
1--Doesn't require review before save
2--Requires review before save