In this tutorial you will learn:

How to create shift objects when integrating with ShiftExpert –
This example uses the SOAPUI test tool to simulate the integration.

Preperation : Create the wsdl.jsp.xml

Go to Setup->Develop->API and click Generate to create the wsdl file that you will use to access the ShiftExpert objects from an external system. Save the file locally.

wsdl`
1. Download and install SOAPUI
http://sourceforge.net/projects/soapui/files/soapui/5.0.0/SoapUI-x32-5.0.0.exe/download
We will use SOAPUI to simulate an external system whichintegrates with ShiftExpert
2. Open SOAP UI and create a new SOAP project
a. Give the project a name
b. Initial WSDL – browse to where you saved the attached wsdl.jsp.xml

Click on ‘OK’
3. Double click on the request1 under the login function

SOAPUI1

Replace the default SOAP message in the request with the following message:

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:urn=”urn:enterprise.soap.sforce.com”>

<soapenv:Header>

</soapenv:Header>

<soapenv:Body>

<urn:login>

<urn:username>api@pgidemo.com</urn:username>

<urn:password>pgidemo12FCF96Uj4ByCxcQ9L2g1PNerQM</urn:password>

</urn:login>

</soapenv:Body>

</soapenv:Envelope>

Click on the Green triangle to send the message.

4. See the response and
a. Copy the content of the ServerURL to the upper URL address
b. Copy the SessionID and place it in the SOAP message below

SOAPUI2

ShiftExpert authentication is based on oAuth2.0 which requires security token. This is given as the Session ID.
5. Send the following SOAP message that will create a new shift

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:urn=”urn:enterprise.soap.sforce.com” xmlns:urn1=”urn:sobject.enterprise.soap.sforce.com” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>

<soapenv:Header>

<urn:SessionHeader>

<urn:sessionId>PLACE HERE THE SESSION ID YOU GOT IN THE PREVIOUS RESPONSE</urn:sessionId>

</urn:SessionHeader>

</soapenv:Header>

<soapenv:Body>

<urn:create>

<urn:sObjects xsi:type=”urn1:CKSW_BASE__Shift__c”>

<CKSW_BASE__Start__c>2014-08-14T08:00:00+00:00</CKSW_BASE__Start__c>

<CKSW_BASE__Finish__c>2014-08-14T10:00:00+00:00</CKSW_BASE__Finish__c>

<!–>Kansas Employees<–>

<CKSW_BASE__Location__c>a072000000tfcvf</CKSW_BASE__Location__c>

<!–>Lead Operator<–>

<CKSW_BASE__Position__c>a092000000gdaED</CKSW_BASE__Position__c>

<!–>Howard Donalds<–>

<CKSW_BASE__Resource__c>a0D2000000QnUuwEAF</CKSW_BASE__Resource__c>

<!–>Apple<–>

<Account__c>0012000001BuWOa</Account__c>

<!–>Phillips 66 2015 Roadmap<–>

<Work_Order__c>a0P2000000HLS3X</Work_Order__c>

<Gantt_Label__c>Apple</Gantt_Label__c>

<CKSW_BASE__Availability_Type__c>Standard</CKSW_BASE__Availability_Type__c>

<CKSW_BASE__Status__c>Open</CKSW_BASE__Status__c>

</urn:sObjects>

</urn:create>

</soapenv:Body>

</soapenv:Envelope>

 


SOAP Message for creating a new work order

The following SOAP message will create a new work order. There are 2 things to note here. If you look on the Customer_r tag, you will see it contains an ExternalRefID__c. This ID should be the same ID as on the system you are integrating with. You won’t need the Salesforce object ID (you will need to enter it only once to the specific record, this can be done with integration as well or different data loading tools). We can set an external ID on every object. The 2nd thing to note is the create_jobs_c. If set to true, the work order will be created with unassigned jobs. This is basically the same as the decompose work order button on the UI.

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:urn=”urn:enterprise.soap.sforce.com” xmlns:urn1=”urn:sobject.enterprise.soap.sforce.com” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>

<soapenv:Header>

<urn:SessionHeader>

<urn:sessionId>00D20000000oY2x!AQUAQO0jUj7jQt9E0vPB2AKgzRowgKnBSAXNdzbUSdblthFrThAO5II509T5OCePHf7b3XgKCGQ2G9ybuF1bH0vFD2pCPHm3</urn:sessionId>

</urn:SessionHeader>

</soapenv:Header>

<soapenv:Body>

<urn:create>

<urn:sObjects xsi:type=”urn1:Work_Order__c”>

<Name>Roadmap 3</Name>

<Customer__r>

<ExternalRefID__c>1</ExternalRefID__c>

</Customer__r>

<Start__c>2014-11-11T08:00:00+00:00</Start__c>

<Finish__c>2014-11-11T10:00:00+00:00</Finish__c>

<High_Profile_Call__c>true</High_Profile_Call__c>

<Location__r>

<ExternalRefID__c>100</ExternalRefID__c>

</Location__r>

<Number_of_ports__c>100</Number_of_ports__c>

<Status__c>Open</Status__c>

<create_jobs__c>false</create_jobs__c>

</urn:sObjects>

</urn:create>

</soapenv:Body>

</soapenv:Envelope>

 

 

(Don’t forge to change the session ID)

 

If you wish to learn more about external IDs, there is a video about it here: http://www.youtube.com/watch?v=QjWCFUXCuOg