How can you create a URL/Link Attachment via Service Desk Manager Web Services?

Document ID : KB000026276
Last Modified Date : 14/02/2018
Show Technical Document Details

Question:

How can you create a URL attachment and attach it to a request using the Service Desk Web Services API?

Answer

The following solution provides code excerpts from a Microsoft Visual Basic Application making calls to the Service Desk Web Services API.

It is not a complete application and is only provided as an example of how this may be done in your environment.

  1. The first step is to create the Attachment object for your link attachment.

    To do this, the "createObject" method can be used.

    The "orig_file_name" should be the actual hyperlink.

    For example:

    Dim updateAttach(6) As String
    Dim attributes(1) As String
    Dim objResultAttach As String = ""
    Dim newHandleAttach As String = ""
    Dim docURL = "http://ca.com"
    Try
    updateAttach(0) = "description"
    updateAttach(1) = docUrl
    updateAttach(2) = "orig_file_name"
    updateAttach(3) = docUrl
    updateAttach(4) = "attmnt_name"
    updateAttach(5) = "Helpful Name for Link"

    ws.createObject(sid, "attmnt" , updateAttach, attributes, objResultAttach, newHandleAttach)

  2. The second step is to use the "createObject" a second time. This time it will be used to create the link between the call request and the attachment.

    This is done by creating a link, a row in the "attmnt_lrel" table.

    The "lpid" should be the Request "handle"/persid.

    The "rpid" should be the Attachment "handle"/persid.

    For example:

    Dim attrVals(14) As String
    Dim attributes(1) As String
    Dim createObjectResult As String = ""
    Dim newHandle As String = ""
    Try
    attrVals(0) = "lpid"
    attrVals(1) = "cr:400002"
    attrVals(2) = "lattr"
    attrVals(3) = "attachments"
    attrVals(4) = "rpid"
    attrVals(5) = "attmnt:400003"""
    attrVals(6) = "rattr"
    attrVals(7) = "requests"

    ws.createObject(sid, "attmnt_lrel" , attrVals, attributes, createObjectResult, newHandle)

Additional Information:

Further information on CA Service Desk Manager Web Services is located here: 

https://docops.ca.com/ca-service-management/14-1/en/building/building-ca-service-desk-manager/web-services-management