Closed MocanuMarius closed 3 years ago
Hi Marius, We have been looking into this issue and have a couple of questions:
If it helps to speed up things, we can schedule a short meeting.
Thank you Karsten
Hi Marius,
I tried this out by modifying query.js in examples project and now I am able to fetch custom field in the Bill Object. Please find the code below. I hope this helps !!
` const client = bootstrap.client(logger);
let filter = new IA.Functions.Common.NewQuery.QueryFilter.OrOperator();
filter.addFilter(new IA.Functions.Common.NewQuery.QueryFilter.Filter("CUSTOMFIELD2").like("1099 Int"));
filter.addFilter(new IA.Functions.Common.NewQuery.QueryFilter.Filter("CUSTOMFIELD2").like("customFieldValue2"));
let orderBuilder = new IA.Functions.Common.NewQuery.QueryOrderBy.OrderBuilder();
orderBuilder.addDescending("VENDORNAME");
const orders = orderBuilder.orders;
let selectBuilder = new IA.Functions.Common.NewQuery.QuerySelect.SelectBuilder();
selectBuilder.addFields(["VENDORNAME", "CUSTOMFIELD2"])
;
const selects = selectBuilder.selects;
let query = new IA.Functions.Common.NewQuery.Query();
query.selectFields = selects;
query.fromObject = "APBILL";
query.filter = filter; // Comment out this line to see all invoices without any filtering
query.caseInsensitive = true;
query.pageSize = 100;
query.orderBy = orders;
logger.info("Executing query to Intacct API");
const response = await client.execute(query);
const result = response.getResult();
logger.debug("Query 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,
});
let json_data = result.data;
if (json_data && Array.isArray(json_data) && json_data.length >= 1) {
console.log(`Success! Total number of results: ${ result.totalCount.toString() }\n`);
console.log(`First ARINVOICE result found: ${ JSON.stringify(json_data[0]) }`);
console.log("See the log file (logs/intacct.html) for the complete list of results.\n");
} else {
console.log("The query executed, but no ARINVOICE objects met the query criteria.\n");
console.log("Either modify the filter or comment it out from the query.\n");
console.log("See the log file (logs/intacct.html) for the XML request.\n");
}`
API v1.3.0
Hi, i added custom fields to a bill object, just like in your tests:
When i try to query the recently created bill object,
Every other property is returned correctly, but both "CUSTOMFIELD1" and "CUSTOMFIELDS" is empty, i didn't find a way to retrieve the data i inserted.
Is there any example or tests i can look into on how to retrieve them ?