sendAndGetXML_Intacct
Un desarrollador de JavaScript debe modificar esta secuencia de comandos de inicio de CCDS para su caso de uso. No funcionará sin modificaciones.
Guarde el siguiente bloque de código como secuencia de comandos en su SAGE Intacct CCDS y asígnele el nombre sendAndGetXML_Intacct.
function sendAndGetXML_Intacct(intacctURL,strXMLRequest) { //Make the request to Intacct and look for errors in the result //The actual request is in strXMLRequest in fully formed XML //If no errors found then return the body of the response to the caller, otherwise return false. //The caller is responsible for checking the response and parsing out the payload. //Create a https request to send to Intacct API var url = intacctURL; var method = 'POST'; var body = strXMLRequest; var headers = { 'Content-Type': 'x-intacct-xml-request' }; var response, responseBody; //Send request and receive response try { response = ai.https.request(url, method, body, headers); } catch(e) { //catastrophic failure ai.log.logError('Intacct Request Failed','Intacct request failed. Error: ' + e + ' req: ' + body); return false; } //verify a good http return code var httpCode = response.getHttpCode(); if (httpCode != '200') { ai.log.logError('Intacct Request Failed','Intacct request failed. Http response code: ' + httpCode); return false; } return response.getBody(); }