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

<showprivate>true</showprivate> #200

Closed SageKewalSehgal closed 2 years ago

SageKewalSehgal commented 2 years ago

Hi, We integrate with Intacct via .Net SDK. We are using multi-entity company and we want to get list of AP bills only from the selected entity. Could you please guide me to how can I accomplish this task?

            //fixed fields
            string fixedFields = "APBILL.RECORDID," + //Bill Number
                                 "APBILL.WHENCREATED," +  //Acquisition Date
                                 "TRX_AMOUNT," +  //Line Acquisition Value
                                 "SELECT_SAGE_FIXED_ASSETS_TEMPLATE," + //Template
                                 "CREATE_ASSET_IN_SAGE_FIXED_ASSETS," + //Create Asset 
                                 "APBILL.RECORDNO," + // bill internal number
                                 "LINE_NO," + //line Number
                                 "SFA_PIS_DATE," + //PIS Date
                                 "APBILL.VENDORID," + //Vendor
                                 "ASSET_CREATED,"; //Asset Created";

            //add mapped fields
            if (m_settings[01].ID > 0) fixedFields += "ACCOUNTNO,"; //G/L asset account no
            if (m_settings[02].ID > 0) fixedFields += "ENTRYDESCRIPTION,"; //Bill description/Memo
            if (m_settings[03].ID > 0) fixedFields += "CLASSID,"; //class id
            if (m_settings[04].ID > 0) fixedFields += "CUSTOMERID,"; //customer id
            if (m_settings[05].ID > 0) fixedFields += "DEPARTMENTID,"; //Line item Department
            if (m_settings[06].ID > 0) fixedFields += "EMPLOYEEID,"; // employee ID
            if (m_settings[07].ID > 0) fixedFields += "ITEMID,"; // Item ID
            if (m_settings[08].ID > 0) fixedFields += "LOCATIONID,"; //Line Item Location
            if (m_settings[09].ID > 0) fixedFields += "PROJECTID,"; //project ID
            if (m_settings[10].ID > 0) fixedFields += "APBILL.DOCNUMBER"; //reference no

            //Example of how to use GenericXMLQuery
            IntacctGenericXMLQuery query = new IntacctGenericXMLQuery();
            query.functName = "readByQuery";
            fixedFields = fixedFields.TrimEnd(',');

            query.tagsDict = new System.Collections.Generic.Dictionary<string, string>()
            {
                { "object", "APBILLITEM" },
                { "fields", fixedFields },
                { "query", "" },
                { "pagesize", "2000" },
            };

            try
            {
                Task<OnlineResponse> CreateTask = ConfigSettings.Client.Execute(query);
                CreateTask.Wait();
                OnlineResponse Response = CreateTask.Result;
                Result result = Response.Results[0];
dylan-holt-sage commented 2 years ago

@SageKewalSehgal, have you taken a look at the documentation for getting AP Bill lists? https://developer.intacct.com/api/accounts-payable/bills/#query-and-list-bills

Also, based on what I'm seeing from your code, I don't see where you're calling anything from our SDK objects with regards to AP Bill or our Query related objects. https://intacct.github.io/intacct-sdk-net/annotated.html