Skip to content
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

Reading custom fields not working #56

Closed
MocanuMarius opened this issue Feb 3, 2021 · 2 comments
Closed

Reading custom fields not working #56

MocanuMarius opened this issue Feb 3, 2021 · 2 comments
Labels

Comments

@MocanuMarius
Copy link

MocanuMarius commented Feb 3, 2021

API v1.3.0

Hi, i added custom fields to a bill object, just like in your tests:

        record.customFields = [
            [ "customfield1", "customvalue1" ],
        ];

When i try to query the recently created bill object,

            queryFields: [
                "RECORDNO",
                "VENDORID",
                "WHENCREATED",
                "WHENDUE",
                "CURRENCY",
                "APBILLITEMS",
                "DESCRIPTION",
                "RECORDID",
                "DOCNUMBER",
               "CUSTOMFIELD1",
               "CUSTOMFIELDS"
            ], 

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 ?

@karstenintacct
Copy link

karstenintacct commented Apr 19, 2021

Hi Marius,
We have been looking into this issue and have a couple of questions:

  1. Would you be able to execute the XML request against your tenant, using Postman? Please make sure that the custom field exists. If you still face issues, even though everything looks correct, please open a support case for the XML request failing.
  2. If it works correctly, please share the XML request that you have successfully posted using Postman, vs. what was generated in the SDK. We don't see the issue at this moment.
  3. Could you refer to the test case you mentioned in your description?

If it helps to speed up things, we can schedule a short meeting.

Thank you
Karsten

@atul-sadhu-sage
Copy link
Contributor

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");
    }`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants