Creating a call to post data to an api

  • Goal-- Use a table in retool where a user can review the data then clicks a button to import the data to intacct via api.

  • My Issue -- I'm trying to create an call to intacct (see code below). I can authenticate and create the header, but having issues creating the line items. I dont know how many I will need with each call so I can't build it out that way.

table data

Code for the call to intacct.

create_invoice>
    <customerid>CUSTOMER1</customerid>
    <datecreated>
        <year>2015</year>
        <month>06</month>
        <day>30</day>
    </datecreated>
    <dateposted>
        <year>2015</year>
        <month>06</month>
        <day>30</day>
    </dateposted>
    <datedue>
        <year>2020</year>
        <month>09</month>
        <day>24</day>
    </datedue>
    <termname>N30</termname>
    <batchkey>20323</batchkey>
    <action>Submit</action>
    <invoiceno>234</invoiceno>
    <ponumber>234235</ponumber>
    <description>Some description</description>
    <externalid>20394</externalid>
    <billto>
        <contactname>28952</contactname>
    </billto>
    <shipto>
        <contactname>289533</contactname>
    </shipto>
    <basecurr>USD</basecurr>
    <currency>USD</currency>
    <exchratedate>
        <year>2015</year>
        <month>06</month>
        <day>30</day>
    </exchratedate>
    <exchratetype>Intacct Daily Rate</exchratetype>
    <nogl>false</nogl>
    <supdocid>6942</supdocid>
    <customfields>
        <customfield>
            <customfieldname>customfield1</customfieldname>
            <customfieldvalue>customvalue1</customfieldvalue>
        </customfield>
    </customfields>
    <invoiceitems>
        <lineitem>
            <accountlabel>TestBill Account1</accountlabel>
            <offsetglaccountno>93590253</offsetglaccountno>
            <amount>76343.43</amount>
            <memo>Just another memo</memo>
            <locationid>Location1</locationid>
            <departmentid>Department1</departmentid>
            <key>Key1</key>
            <totalpaid>23484.93</totalpaid>
            <totaldue>0</totaldue>
            <customfields>
                <customfield>
                    <customfieldname>customfield1</customfieldname>
                    <customfieldvalue>customvalue1</customfieldvalue>
                </customfield>
            </customfields>
            <revrectemplate>RevRec1</revrectemplate>
            <defrevaccount>2100</defrevaccount>
            <revrecstartdate>
                <year>2016</year>
                <month>06</month>
                <day>01</day>
            </revrecstartdate>
            <revrecenddate>
                <year>2017</year>
                <month>05</month>
                <day>31</day>
            </revrecenddate>
            <projectid>Project1</projectid>
            <customerid>Customer1</customerid>
            <vendorid>Vendor1</vendorid>
            <employeeid>Employee1</employeeid>
            <itemid>Item1</itemid>
            <classid>Class1</classid>
            <warehouseid>Warehouse1</warehouseid>
        </lineitem>
    </invoiceitems>
</create_invoice>

Hi @David_Looser, if I understand correctly - do you need to convert the data in the table to an XML format dynamically to send in the request to intacct?

If so, you can use the JS Query to write custom Javascript and convert the data from the table into the required format, and refer the results from that in your request body to intacct.

You are correct in your understanding. Would you have an example of this? Just so I know I'm on the right path. Thanks