Here is an example. I think this worked with Istanbul or Jakarta using the direct table SOAP API. Setting up a scripted SOAP API is probable better that using the direct table API.
Here is an example of getting data from ServiceNow.
<?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://servicenowdev.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="">greiff</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>
For ServiceNow to write into PPM, you are going to need to use the Object API. To read use the Query API -- Have your PPM team built you an NSQL which provide the data you are looking for from PPM to ServiceNow and that query will be available in the Query API.
https://cppm-dev.ondemand.ca.com/niku/wsdl/Object?tenantId=clarityhttps://cppm-dev.ondemand.ca.com/niku/wsdl/Query?tenantId=clarityV/r,
Gene
Original Message:
Sent: 07-14-2020 08:31 AM
From: Luis Rodriguez
Subject: Integrating Clarity with Service Now
Hello,
I was wondering if someone integrated Clarity with ServiceNow in the past.
This is what I want to configure:
- Have Clarity make an API call to update ServiceNow when a project changes to open or from open to closed.
- Have ServiceNow make the appropriate API Calls into Clarity on a schedule. I know how to do this on the ServiceNow side, but I'm not sure what the API Calls would be for Clarity. Again, I need to determine all the currently open projects.
- If neither of the above work, can Clarity send an email to a specific email address each time the state of a project changes? (open, closed.. whatever other states there may be?)
Thanks!