-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error with AccountsReceivable.CustomerUpdate but not in XML API #74
Comments
Just noticed #26 Which explains why the smart rule is getting thrown, since the fn seems to be including the "TAXABLE" XML tag even though I am not specifying taxable. Which tells me that it's trying to clear every field that I don't explicitly specify on the update function. Wouldn't that mean that the example here would set active to true, but also unintentionally clear out every single other field?? |
I'm getting around it now with this simple CRUD custom function, which IMO is actually easier to use (albeit more loose) class ObjectCRUD extends IA.Functions.AbstractFunction {
constructor(objectName, method, object) {
super();
this._objectName = objectName;
this._method = method;
this._object = object;
}
writeXml (xml) {
xml.writeStartElement("function");
xml.writeAttribute("controlid", this.controlId, true);
xml.writeStartElement(this._method);
if (method === 'delete') {
xml.writeElement('object', this._objectName);
xml.writeElement('keys', this._object);
}
else {
// insert or update
xml.writeStartElement(this._objectName);
for (let key in this._object) {
if (this._object.hasOwnProperty(key)) {
xml.writeElement(key, this._object[key]);
}
}
xml.writeEndElement(); // object name
}
xml.writeEndElement(); // method
xml.writeEndElement(); // function
};
}
intacctApi.update = function (objectName, object) {
let action = new ObjectCRUD(objectName, 'update', object);
return intacctApi.IAClient.execute(action);
}
intacctApi.insert = function (objectName, object) {
let action = new ObjectCRUD(objectName, 'create', object);
return intacctApi.IAClient.execute(action);
}
intacctApi.delete = function (objectName, recordNo) {
let action = new ObjectCRUD(objectName, 'delete', recordNo);
return intacctApi.IAClient.execute(action);
} Such that I can then just call const updateRes = await intacctApi.update('CUSTOMER', {
CUSTOMERID: 'TESTCUSTOMER',
COMMENTS: 'test new comment',
}); |
I am attempting to follow the example to update a customer record to simply change the "comments" field via the example provided here https://github.com/Intacct/intacct-sdk-node-js-examples/blob/master/crud-customer.js
However it keeps throwing "BL04002055 Smart Rule CUST_REQ_TAXABLE Violated The Taxable field (Additional info tab) must be checked. [Support ID: 7lGI7EB030%7EYTuKDP0g2Pw--dgW6G9JxgAAAAI]". I'm not setting TAXABLE or any fields that would affect this smart rule. And this does not error when I use the Update Customer XML API directly.
My code
However, following the documentation here https://developer.intacct.com/api/accounts-receivable/customers/#update-customer
I'm able to successfully update the customer as expected using the raw XML request in postman. Confirmed by checking the comments field on the record after executing the call.
ALSO why does the CustomerUpdate() function not support being able to reference customer by RECORDNO when either RECORDNO or CUSTOMERID is supported in the XML API?
The text was updated successfully, but these errors were encountered: