intacct / intacct-sdk-net

Official repository of the Sage Intacct SDK for .NET
https://developer.intacct.com/tools/sdk-net/
Apache License 2.0
31 stars 45 forks source link

Query List of Invoices #20

Closed jmawebtech closed 6 years ago

jmawebtech commented 6 years ago

Hi,

Should I contact you through the partner portal or through here?

How do I query Intacct for a list of invoices? I cannot find sample code to query under order entry:

https://github.com/Intacct/intacct-sdk-net/tree/4c0d324550d108ef22cc9a649636f3e93db2ed98/Intacct.SDK.Tests/Functions/OrderEntry

Here is my code:

public void SearchInvoices(List<string> orderNumbers)
{
    InListString query = new InListString()
    {
        Field = "ExternalId",
        ValuesList = orderNumbers,
    };

    ReadByQuery readByQuery = new ReadByQuery()
    {
        ObjectName = "ORDERENTRYTRANSACTION",
        Fields = { "ExternalId" },
        Query = query
    };

    Task<OnlineResponse> task = Client().Execute(readByQuery);
    task.Wait();
    OnlineResponse response = task.Result;
}
jimmymcpeter commented 6 years ago

Here is good for those also using the SDK. If you had questions about using Sage Intacct or bug related to the API itself, you'd need to go through https://community.intacct.com. Since there's no response schema for the API today it makes writing readByQuery and read classes for every object somewhat of a bear. We obviously can consider it if people really want it.

As for your code, take a look at the API reference here for Order Entry Transactions -- https://developer.intacct.com/api/order-entry/order-entry-transactions/#list-order-entry-transactions

I think you need to change your ObjectName property to equal SODOCUMENT. You may also consider setting the DocParId property if these are all one type of transaction definition (ex: Sales Invoice or Sales Order). Setting the DocParId will return any custom fields on that object.