You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've modified the node-js example code to test out creating an invoice:
/** * Copyright 2020 Sage Intacct, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not * use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "LICENSE" file accompanying this file. This file is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */gettingStarted();asyncfunctiongettingStarted(){constbootstrap=require("./bootstrap");constIA=require("@intacct/intacct-sdk");letlogger=bootstrap.logger();try{constclient=bootstrap.client(logger);letcreate=newIA.Functions.AccountsReceivable.InvoiceCreate();create.customerId="CU01"create.transactionDate=newDate();create.dueDate=newDate();constline=newIA.Functions.AccountsReceivable.InvoiceLineCreate();line.glAccountNumber="5220";line.amount=76343.43;line.locationId="01";line.departmentId="00";line.employeeId="EM01";create.lines=[line];logger.info("Executing read to Intacct API");constresponse=awaitclient.execute(create);constresult=response.getResult();logger.debug("Read successful",{"Company ID": response.authentication.companyId,"User ID": response.authentication.userId,"Request control ID": response.control.controlId,"Function control ID": result.controlId,"Data": result.data,});letjson_data=result.data;console.log("Result:");console.log(JSON.stringify(json_data));}catch(ex){if(exinstanceofIA.Exceptions.ResponseException){logger.error("An Intacct response exception was thrown",{"Class": ex.constructor.name,"Message": ex.message,"API Errors": ex.errors,});console.log("Failed! "+ex.message);}else{logger.error("An exception was thrown",{"Class": ex.constructor.name,"Message": ex.message,});console.log(ex.name)}}}
This raises an exception:
{"API Errors":["XL03000003 XML Parse schema error: Error 1871: Element 'locationid': This element is not expected. Expected is one of ( offsetglaccountno, amount ).. Line: 1, column: 0. [Support ID: Ygt_AWEB033%7EZutZFP1S0eT78kJ-fx8p7AAAAAA]"],"Class":"ResponseException","Message":"Response control status failure - XL03000003 XML Parse schema error: Error 1871: Element 'locationid': This element is not expected. Expected is one of ( offsetglaccountno, amount ).. Line: 1, column: 0. [Support ID: Ygt_AWEB033%7EZutZFP1S0eT78kJ-fx8p7AAAAAA]","level":"error","message":"An Intacct response exception was thrown"}
I've received the same error when constructing the raw XML and hitting API without any SDK layer. When I set a locationId in my login block when creating my session and remove it here, it works (I have a multi-location account, but in that case the locationId has to be my top level entity).
Does the API not support creating invoices for a specific location under my top level entity?
The text was updated successfully, but these errors were encountered:
The issue is because the XML produced is sensitive to the order of the sibling elements and I think this library is producing the elements out of order from what the documentation outlines.
I can reproduce by hand constructing and sending the XML to the API and then when I change the ordering of the sibling elements for the <lineitem /> group to match what the documentation has, it works.
I've modified the node-js example code to test out creating an invoice:
This raises an exception:
I've received the same error when constructing the raw XML and hitting API without any SDK layer. When I set a locationId in my login block when creating my session and remove it here, it works (I have a multi-location account, but in that case the locationId has to be my top level entity).
Does the API not support creating invoices for a specific location under my top level entity?
The text was updated successfully, but these errors were encountered: