Soap message getRecords

traviswarren
Kilo Expert

Hello, Is there a way to insert or update data in your instance from a getRecords function call.   Essentially, instead of the source instance sending data to the target instance I want to pull in data to the target instance from the source. To provide an example. I have a soap message from the target instance pointing to the source instance.   I have a getRecords method setup to retrieve records from the parameters I specified.   From that response, can I insert that data into my target instance? Thanks in advance.

6 REPLIES 6

ok, i see.


Have you tried to do something like that :


In your script:


You should have something like this:


var sGetRecords = new SOAPMessage('YourService', 'getRecords');


var response = sGetRecords.post(); // You have to get <getRecordsResult> array


var sInsertMultiple = new SOAPMessage('YourService', 'insertMultiple'); //Construct your request here


your soap request should be like this:


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inc="http://www.service-now.com/incident">


    <soapenv:Header/>


    <soapenv:Body>


          <inc:insertMultiple>


                <record>


                      <short_description>this is test 1</short_description>


                </record>


                <record>


                      <short_description>this is test 2</short_description>


                </record>


                <record>


                      <short_description>this is test 3</short_description>


                </record>


          </inc:insertMultiple>


    </soapenv:Body>


</soapenv:Envelope>


sInsertMultiple.post();


avinashrvn
Tera Contributor

Hi Traviswarren,



Instead of source pushing the Records, Did you manage to pull the records from target instance using getRecords() function call and update the records from the target instance itself, I have a similar requirement and would like to know if this is feasible.



Regards,


Avinash