주 컨텐츠로 이동
Adaptive Planning
최종 업데이트: 2023-06-23
sendAndGetXML_Intacct

sendAndGetXML_Intacct

이 CCDS 시작 스크립트는 사용 사례에 맞게 JavaScript 개발자가 수정해야 합니다. 수정하지 않으면 작동하지 않습니다.
아래 코드블록을 SAGE Intacct CCDS에 스크립트로 저장하고 이름을 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(); }