In ServiceNow you need to define an import set.
https://docs.servicenow.com/bundle/london-platform-administration/page/administer/import-sets/reference/import-sets-landing-page.html Here is some GEL code for using soap with ServiceNow (this was using direct table access vs import sets)
V/r,
Gene
<?xml version="1.0" encoding="utf-8"?>
<gel:script
xmlns:core="jelly:core"
xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:nikuq="http://www.niku.com/xog/Query"
xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="jelly:sql"
xmlns:util="jelly:util"
xmlns:x="jelly:org.apache.commons.jelly.tags.xml.XMLTagLibrary"
xmlns:xog="http://www.niku.com/xog"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<gel:log>Start this Script</gel:log>
<core:set var="soapEndPoint" value="https://demo.service-now.com/sys_user_list.do?SOAP" />
<core:invokeStatic var="base64" className="com.niku.union.utility.Base64" method="encode">
<core:arg type="java.lang.String" value="admin:password" />
</core:invokeStatic>
<core:set var="basicAuth" value="Basic ${base64}" />
<gel:log>basicAuth = ${basicAuth}</gel:log>
<core:new var="soapUrl" className="java.net.URL">
<core:arg type="java.lang.String" value="${soapEndPoint}" />
</core:new>
<core:invoke var="connection" on="${soapUrl}" method="openConnection"/>
<core:expr value="${connection.setDoOutput(true)}" />
<core:expr value='${connection.setRequestMethod("POST")}'/>
<core:expr value='${connection.setRequestProperty("Content-type", "text/xml; charset=utf-8")}'/>
<core:expr value='${connection.setRequestProperty("SOAPAction", soapEndPoint)}'/>
<core:expr value='${connection.setRequestProperty("Authorization", basicAuth)}'/>
<core:set var="requestXml">
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<Action soapenv:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.service-now.com/sys_user/getRecords</Action>
</soapenv:Header>
<soapenv:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<getRecords xmlns="http://www.service-now.com/sys_user">
<last_name xmlns="">admin</last_name>
</getRecords>
</soapenv:Body>
</soapenv:Envelope>
</core:set>
<core:invoke var="outputStream" on="${connection}" method="getOutputStream" />
<core:new var="outputStreamWriter" className="java.io.OutputStreamWriter">
<core:arg type="java.io.OutputStream" value="${outputStream}" />
</core:new>
<core:expr value="${outputStreamWriter.write(requestXml)}" />
<core:expr value="${outputStreamWriter.close()}" />
<core:invoke var="inputStream" on="${connection}" method="getInputStream" />
<core:new var="inputStreamReader" className="java.io.InputStreamReader">
<core:arg type="java.io.InputStream" value="${inputStream}" />
</core:new>
<core:new var="stringBuilder" className="java.lang.StringBuilder" />
<core:set var="data" value="${inputStreamReader.read()}" />
<core:while test="${data != -1}">
<core:invokeStatic var="char" className="java.lang.Character" method="toChars" >
<core:arg type="int" value="${data}" />
</core:invokeStatic>
<core:invokeStatic var="charString" className="java.lang.String" method="valueOf" >
<core:arg value="${char}" />
</core:invokeStatic>
<core:set var="char" value="${java.lang.String.valueOf(java.lang.Character.toChars(data))}"/>
<core:invoke method="append" on="${stringBuilder}">
<core:arg value="${charString}" />
</core:invoke>
<core:set var="data" value="${inputStreamReader.read()}" />
</core:while>
<core:set var='soapEnvIndex' value='${stringBuilder.toString().indexOf("SOAP-ENV")}' />
<gel:log>This is the index for soapEnvIndex = ${soapEnvIndex}</gel:log>
<gel:log>${stringBuilder.toString().substring(soapEnvIndex-1)}</gel:log>
<gel:log>End this Script</gel:log>
</gel:script>
Original Message:
Sent: 02-06-2020 09:44 AM
From: Arunachalam Angusamy
Subject: Service Now - Integration Question
Hi Eugene,
Is there a document available how to setup the map ?
Original Message:
Sent: 01-28-2020 07:23 AM
From: Eugene Greiff
Subject: Service Now - Integration Question
On a side note, you might want to consider SOAP instead of REST which is supported by ServiceNow and easier for GEL to use. Just have the SN admin setup a import map along with a transform map that you can access via soap.
V/r,
Gene
Original Message:
Sent: 01-28-2020 07:02 AM
From: Eugene Greiff
Subject: Service Now - Integration Question
ServivceNow has a REST explore which will show you how to call an endpoint. If you need to do something a little more complicated that just creating a work order record, you can create a specific endpoint for executing any number of functions.
V/r,
Gene
Original Message:
Sent: 01-27-2020 03:13 PM
From: Arunachalam Angusamy
Subject: Service Now - Integration Question
Hi Everyone,
I have a requirement that once the idea is converted to a project, I need to create a work order in Service Now with the specific set of information. I already have a solution that I am sending an email to the service now and it is creating the ticket. I really wanted to use the API rest call provided for ServiceNow. I have no clue how to start with API. Any clue or basic information will be helpful where how to start ? Note : I already have a GEL script to pull the information from clarity and I need to pass this information to API call.
Please advise.