cancel
Showing results for 
Search instead for 
Did you mean: 

Confirmation of API specifications for integrating BP with ServiceNow

ShumpeiOkano
Verified Partner

I would like to confirm the specifications regarding the asset "Blue Prism Connectors for ServiceNow v1.1".

I would like to use the API to retrieve attachments from ServiceNow via Blue Prism, and I would like to know whether it is possible to obtain attachments using the above asset.

According to the manual, the APIs used in the actions provided by the asset appear to be the following seven:

  • Account API
  • Case API
  • Consumer API
  • Contact API
  • Table API
  • Service Catalog API
  • Change Management API

According to the official ServiceNow website, there is an Attachment API for retrieving attachments. However, since this API does not seem to be included in the above asset, am I correct in understanding that retrieving attachments via the asset is not possible?

If there is another way to retrieve attachments, could you please advise me on the method?

2 REPLIES 2

GeoffHirst
Staff
Staff

Hi @ShumpeiOkano 

Thank you for being a SS&C Blue Prism customer and for using Blue Prism. Thank you for your interest in the Salesforce asset.

At the present time, I do not believe the asset supports the Attachment API as you correctly say. 

My suggestion to you would be to make a request and then we can assess interest and add it to our development backlog.

I hope this will assist you in moving forward.

regards

Geoff Hirst Senior DX Engineer - Digital Exchange - EMEA SS&C Blue Prism

Hi,

try to paste this code in a new page of your object of serviceNow: 

<process name="__selection__Utility - ServiceNow" type="object" runmode="Exclusive"><stage stageid="4190a031-e5da-4e0e-b799-f69a6d05d8e1" name="Start" type="Start"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="-195" /><inputs><input type="collection" name="ConfigParam" stage="ConfigParam" /><input type="text" name="InstanceServiceNow" stage="InstanceServiceNow" /><input type="text" name="sys_id" stage="sys_id" /><input type="text" name="pathToSave" stage="pathToSave" /></inputs><onsuccess>d16608e9-7048-416d-a9c8-b46d0bc1a040</onsuccess></stage><stage stageid="76c64ddb-943a-4864-8a99-a9246775888b" name="InstanceServiceNow" type="Data"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><display x="-225" y="-75" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="113f5a3c-dc1e-402c-8d98-3d1e00bc4600" name="Input" type="Block"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-270" y="-105" w="150" h="105" /><font family="Segoe UI" size="10" style="Regular" color="7FB2E5" /></stage><stage stageid="425efdac-345b-4a60-b771-0b4ae670a962" name="sys_id" type="Data"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><display x="-165" y="-75" /><datatype>text</datatype><initialvalue xml:space="preserve">cc9b0a5fc37162d06061522ed40131bb</initialvalue><private /><alwaysinit /></stage><stage stageid="6d138105-8939-4410-aa9c-26767be7a2a4" name="URL_Temp" type="Data"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-165" y="90" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="cdc06177-23e7-4c0f-aa96-7668564b1870" name="Result" type="Collection"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-165" y="135" /><datatype>collection</datatype><private /><alwaysinit /></stage><stage stageid="e4cee65c-d890-4288-984d-8d371eddebdd" name="Local" type="Block"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-270" y="15" w="150" h="195" /><font family="Segoe UI" size="10" style="Regular" color="FFFF00" /></stage><stage stageid="f7fdc727-de86-437c-9596-bb21f3fd4bcc" name="Output" type="Block"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-270" y="225" w="150" h="60" /><font family="Segoe UI" size="10" style="Regular" color="FF00FF" /></stage><stage stageid="8367dc19-220e-46c7-8559-555aded75c50" name="Exists" type="Data"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><display x="-165" y="45" /><datatype>flag</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="b278d66d-dd53-4b0a-af12-0aeca5c7e419" name="Password" type="Data"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><display x="-225" y="45" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="6aa92a6f-d99c-4e08-8b9f-4ba9172de440" name="pathToSave" type="Data"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><display x="-225" y="-30" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="d16608e9-7048-416d-a9c8-b46d0bc1a040" name="Get Password" type="Calculation"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="-135" /><onsuccess>b89c30c9-f619-4f83-87aa-b5aa7a42bb92</onsuccess><calculation expression="[DriveIt Password]" stage="Password" /></stage><stage stageid="768c3b8e-6b8a-405b-890a-8503b74a0bcc" name="GetAttachments" type="Code"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="-15" /><inputs><input type="text" name="username" expr="[DriveIt UserName]" /><input type="text" name="password" expr="[Password]" /><input type="text" name="sys_id" expr="[sys_id]" /><input type="text" name="instance" expr="[InstanceServiceNow]" /></inputs><outputs><output type="text" name="GetAttachments" stage="GetAttachments" /></outputs><onsuccess>08bb487a-a046-4782-b31c-86c2fca624ae</onsuccess><code><![CDATA[
Dim instanceUrl, ticketSysId
instanceUrl = instance
ticketSysId = sys_id

' Costruzione URL API
Dim url
url = "https://" & instanceUrl & "/api/now/attachment?table_sys_id=" & ticketSysId

' Oggetti per la richiesta HTTP
Dim http, responseText
http = CreateObject("WinHttp.WinHttpRequest.5.1")
http.Open("GET", url, False)
http.SetCredentials(username, password, 0) ' 0 = Basic Auth
http.Send

' Gestione risposta
If http.Status = 200 Then
    responseText = http.ResponseText
Else
    responseText = "Errore: " & http.Status & " - " & http.StatusText
End If

' Output
GetAttachments = responseText
]]></code></stage><stage stageid="de566882-4241-4943-9640-8478f491a6c2" name="Get Attachment File" type="Code"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="405" /><inputs><input type="text" name="fileUrl" expr="[URL_Temp]" /><input type="text" name="savePath" expr="[LocalPathToSave]" /><input type="text" name="username" expr="[DriveIt UserName]" /><input type="text" name="password" expr="[Password]" /></inputs><outputs><output type="text" name="DownloadResult" stage="DownloadResult" /></outputs><onsuccess>11a49a7f-aab2-43b9-80de-ed95bf647dc8</onsuccess><code><![CDATA[
' Oggetto HTTP robusto
Dim http, stream
http = CreateObject("WinHttp.WinHttpRequest.5.1")
http.Open("GET", fileUrl, False)
http.SetCredentials(username, password, 0) ' 0 = Basic Auth
http.Send

If http.Status = 200 Then
    stream = CreateObject("ADODB.Stream")
    stream.Type = 1 ' Binary
    stream.Open
    stream.Write(http.ResponseBody)
    stream.SaveToFile(savePath, 2) ' 2 = Sovrascrive se esiste
    stream.Close
    DownloadResult = "OK"
Else
    DownloadResult = "Errore: " & http.Status & " - " & http.StatusText
End If
]]></code></stage><stage stageid="da875ab8-9234-4c31-9b9a-3aa2208489cf" name="GetAttachments" type="Data"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><display x="-225" y="135" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="08bb487a-a046-4782-b31c-86c2fca624ae" name="Utility - JSON::JSON to Collection" type="Action"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit onsuccess="true" /><display x="-60" y="45" /><inputs><input type="text" name="json" friendlyname="json" expr="[GetAttachments]" /></inputs><outputs><output type="collection" name="Result" friendlyname="Result" stage="Result" /></outputs><onsuccess>0786ba18-5dd6-42d9-98e2-baf2318187f7</onsuccess><resource object="Utility - JSON" action="JSON to Collection" /></stage><stage stageid="80ce5a38-744e-4766-b79f-0a73b27a5f9a" name="Populate Collection 6" type="Code"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="165" /><inputs><input type="collection" name="Result" expr="[Result]" /></inputs><outputs><output type="collection" name="tmpCollection" stage="tmpCollection" /></outputs><onsuccess>101969e6-f56b-4de0-82de-c0cc68a68173</onsuccess><code><![CDATA[
For Each row As DataRow In Result.Rows
    Dim innerTable As DataTable = TryCast(row("JSON:Array"), DataTable)
    If innerTable IsNot Nothing Then
        ' Se dtDest è vuoto, copia la struttura della prima tabella interna
        If tmpCollection.Columns.Count = 0 Then
            tmpCollection = innerTable.Clone()
        End If

        ' Aggiungi ogni riga della tabella interna a dtDest
        For Each innerRow As DataRow In innerTable.Rows
            tmpCollection.ImportRow(innerRow)
        Next
    End If
Next
]]></code></stage><stage stageid="cd021efa-ef86-4228-996f-a012c1c4185b" name="tmpCollection" type="Collection"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><display x="-225" y="90" /><datatype>collection</datatype><private /><alwaysinit /></stage><stage stageid="0786ba18-5dd6-42d9-98e2-baf2318187f7" name="Get Result" type="MultipleCalculation"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="105" /><onsuccess>80ce5a38-744e-4766-b79f-0a73b27a5f9a</onsuccess><steps><calculation expression="[Result.result]" stage="Result" /></steps></stage><stage stageid="67a3ce37-7ca8-4e12-818b-e5680b44eee9" name="Get download_link" type="Calculation"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="285" /><onsuccess>f676a17e-b8cd-4d05-9add-35abfa695863</onsuccess><calculation expression="[tmpCollection.download_link]" stage="URL_Temp" /></stage><stage stageid="4bb076c1-37bd-4a14-bf18-e98a7317a86e" name="DownloadResult" type="Data"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><display x="-225" y="180" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="f676a17e-b8cd-4d05-9add-35abfa695863" name="Get file_name" type="Calculation"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="345" /><onsuccess>de566882-4241-4943-9640-8478f491a6c2</onsuccess><calculation expression="[pathToSave]&amp;[tmpCollection.file_name]" stage="LocalPathToSave" /></stage><stage stageid="101969e6-f56b-4de0-82de-c0cc68a68173" name="Loop Start1" type="LoopStart"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="225" /><onsuccess>67a3ce37-7ca8-4e12-818b-e5680b44eee9</onsuccess><groupid>93caa16d-59b2-43bb-b267-3584e6e5650f</groupid><looptype>ForEach</looptype><loopdata>tmpCollection</loopdata></stage><stage stageid="065ea052-9759-4765-90af-2d77b7841d2d" name="Loop End1" type="LoopEnd"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="645" /><groupid>93caa16d-59b2-43bb-b267-3584e6e5650f</groupid></stage><stage stageid="887b17f8-0c3f-40d4-8d5d-8c1c662ee1fa" name="[DownloadResult] = &quot;OK&quot;" type="Decision"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="525" /><decision expression="[DownloadResult] = &quot;OK&quot;" /><ontrue>270797a5-75f5-4c32-bcca-81d3cc90ab09</ontrue><onfalse>1b399e10-fb64-4222-8b70-5d8a18742c37</onfalse></stage><stage stageid="44bf8155-eaf8-42d4-8a5e-f7550bf2f36a" name="CollectionOutput" type="Collection"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-225" y="255" /><datatype>collection</datatype><private /><alwaysinit /><collectioninfo><field name="FileName" type="text" /><field name="Status Download" type="text" /><field name="Error Message" type="text" /></collectioninfo></stage><stage stageid="11a49a7f-aab2-43b9-80de-ed95bf647dc8" name="Collections::Add Row" type="Action"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit onsuccess="true" /><display x="-60" y="465" /><inputs><input type="text" name="Collection Name" friendlyname="Collection Name" narrative="The name of the collection to act upon" expr="&quot;CollectionOutput&quot;" /></inputs><onsuccess>887b17f8-0c3f-40d4-8d5d-8c1c662ee1fa</onsuccess><resource object="Blueprism.AutomateProcessCore.clsCollectionActions" action="Add Row" /></stage><stage stageid="270797a5-75f5-4c32-bcca-81d3cc90ab09" name="Download OK" type="MultipleCalculation"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="585" /><onsuccess>065ea052-9759-4765-90af-2d77b7841d2d</onsuccess><steps><calculation expression="&quot;&quot;" stage="CollectionOutput.Error Message" /><calculation expression="[tmpCollection.file_name]" stage="CollectionOutput.FileName" /><calculation expression="&quot;OK&quot;" stage="CollectionOutput.Status Download" /></steps></stage><stage stageid="8dedf950-f074-495f-bc92-3ec0ea28f0c9" name="Download KO" type="MultipleCalculation"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="30" y="585" /><onsuccess>2e78b3cc-27ae-429c-bd9d-c0c4bf8c1b50</onsuccess><steps><calculation expression="[DownloadResult]" stage="CollectionOutput.Error Message" /><calculation expression="[tmpCollection.file_name]" stage="CollectionOutput.FileName" /><calculation expression="&quot;KO&quot;" stage="CollectionOutput.Status Download" /></steps></stage><stage stageid="2e78b3cc-27ae-429c-bd9d-c0c4bf8c1b50" name="Anchor15" type="Anchor"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="30" y="645" w="10" h="10" /><onsuccess>065ea052-9759-4765-90af-2d77b7841d2d</onsuccess></stage><stage stageid="1b399e10-fb64-4222-8b70-5d8a18742c37" name="Anchor16" type="Anchor"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="30" y="525" w="10" h="10" /><onsuccess>8dedf950-f074-495f-bc92-3ec0ea28f0c9</onsuccess></stage><stage stageid="7f32471d-7c1f-4efb-8828-6ae23db6ffb5" name="LocalPathToSave" type="Data"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-165" y="180" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="b89c30c9-f619-4f83-87aa-b5aa7a42bb92" name="Check Path and Create If Not Exist" type="Code"><subsheetid>1eea80e6-489f-4e2e-8191-3d54197c9f9c</subsheetid><loginhibit /><display x="-60" y="-75" /><inputs><input type="text" name="folderPath" expr="[pathToSave]" /></inputs><outputs><output type="text" name="FinalPath" stage="pathToSave" /></outputs><onsuccess>768c3b8e-6b8a-405b-890a-8503b74a0bcc</onsuccess><code><![CDATA[' Aggiunge lo slash finale se manca
If Right(folderPath, 1) <> "\" Then
    folderPath = folderPath & "\"
End If

' Controlla se la cartella esiste
Dim fso
fso = CreateObject("Scripting.FileSystemObject")

If Not fso.FolderExists(folderPath) Then
    fso.CreateFolder(folderPath)
End If

FinalPath = folderPath]]></code></stage></process>

This code use download_link retreived using thi url: "https://" & instanceUrl & "/api/now/attachment?table_sys_id=" & ticketSysId

Let me know if you need assistence for the required dlls.

Simone