Create line items on Quickbooks Invoice

I keep getting an error using the Quickbooks - Create an invoice module
image

I am trying to use JSON to create multiple line items, the screenshot below only has one line item for testing purposes but I’m not having much luck.

I have tried multiple variations and it’s still not working.

Hi @Zack_Stevenson,

As from the error message, it is evident that it needs an array of objects, that needs to be as per what Make requires, but you are passing a string, what you can do is use Parse A JSON module to convert the String to JSON object, and over there, what you want to do is create a JSON array so that it can be used while mapping.

Wrap your JSON around a root element like,

{
  "data" : [
   {
    "Qty" : "",
   .....

}
,....
]
}

Pass it through the Parse a JSON module which will result with a data array that you can use in the QBO line items mapping. Also, Please be aware that Make requires the JSON object key naming to be same as what is being used in the app, you can inspect those fields through Dev console to grab the required names for the fields.

Quick question though, What is your use case looks like? And, Is there a specific reason to use JSON mapping instead of the normal mapping in Make?

If the data for line items is from any previous other modules that you are using, then what you can do is use iterator and aggregator, and in aggregator you can use Target Mapping to QBO Line items, through which it will create the required array of objects expected in QBO.

1 Like

Hi @Runcorn, I had a method to my madness but I think what you are saying is a better idea. However, I’m not totally sure how to make this happen.

Is this what the scenario would look like? I know I am missing something as there’s no way for QuickBooks to know which data point goes to the specific field

If I turn the ‘Map’ off it requires me to specify the number of line items, which could be different each time.
image

Yeah, In the QBO, Use Map option for Line Items and then use the array aggregator output there.

1 Like

How will the module know how to map the fields correctly?

In the aggregator, you will need to use Target Structure to QBO’s LineItems, you can do the mapping over there for Line Items.

2 Likes

I appreciate your help, I am definitely getting closer. The target structure wasn’t giving the option because I hadn’t run it yet.

Here’s where I am at. I thought the array aggregator would aggregate the bundles into 1 bundle?

As you can see the first bundle was processed creating an invoice with one line but the second bundle didn’t work as it was trying to create a new invoice rather than the first operation adding multiple lines.

My guess is it’s because the Array aggregator is outputting multiple bundles?

Hi @Zack_Stevenson,

Not exactly sure about your use case, but is GetRecords returning multiple data? By which I mean, the aggregator is,

My guess is it’s because the Array aggregator is outputting multiple bundles?

Array aggregator will always output a single Bundle, so, you need to set the source module of aggregator correctly, currently it is being set to Get a Record from the screenshot, so maybe try changing it to Iterator.

1 Like

Hey Pawal, I appreciate all the support! I got it too work. I haven’t used Make a ton other than for some very simple automation, so thank you very much!

1 Like