Skip to main content

1 minute loom video question here

Source date = Airtable

Sending to Xero.

 

Having a hard time passing one static field (green items) in a record into the line items that are posting through as arrays and creating their own lines (from the red fields).

 

I do want the separate lines, but need to get the green items into subsequent lines.

Here’s what the zap looks like behind the scenes:

 

Any ideas how to pass the green values into the line items (red) which are created from linked records?

 

Thanks!

 

 

 

Hi @liveca 

Try using Formatter > Utilities.

I suggest checking out some of the published articles in the Zapier Community that deal with Line Items.

Hopefully you can find some inspiration there: https://community.zapier.com/search?q=line%20items&content_type%5B0%5D=article


@Troy Tessalone I’ve attempted to read those utility/line item options and have even gone so far as to try a few, but keep getting either one line or errors.

Do you happen to know some additional terms to search or know of any specific posts that deal with this issue?

Given I’m not taking a list and turning it into line items, I’m hoping there’s a way to mix the two (matching the green with the red array).

Thanks!


@liveca 

I think it may be helpful for us to better understand your desired output with a specific example.

Can you perhaps list out for the given inputs, what the desired output format you want?

NOTE: This may have to involve a custom Code step to handle the line item arrays and logic: https://zapier.com/apps/code/help


HI @Troy Tessalone - Happy to expand on this (you can also see the desired output in the video where I talk through that if you’d rather not use images).

 

Output = all three lines without missing information.

 

For example, this line 1 = okay (it’s not missing line_unit_amount, line_account_code or line_tax_type).

But lines 2 and 3 are missing the non-array information. They’re missing the single line text fields in Airtable that hold one value (line_unit_amount, line_account_code or line_tax_type).

 

 

So if we can pass through the line_unit_amount, line_account_code and line_tax_type fields from Airtable along with this array (if I’m using that term correctly from the multi-selected items in Airtable that these are coming from) that’s what we’re really trying to do here.

 

For reference, here’s the source of the good information (a multiple record link field):

 

And an example of the other field:

Thanks!


Hi @liveca 

I think Code would likely be needed. I am not sure if it could be done with just a formatter action. 

Assuming there will always only ever be 1 item in those fields you could use/expand the below code to accomplish what you need. Code of course can be very specific to what needs to be done but feel free to reach out with any questions you have. 

 

let qtys = inputData.qtys.split(",");
let unit_amount = inputData.unit_amounts;
let account_code = inputData.account_codes;

var new_line_items = s];

qtys.forEach(qty => {
new_line_items.push({
qty: qty,
unit_amount: unit_amount,
account_codes: account_code
})
})
return {new_line_items}

 


@GetUWired This worked!

 

I can’t believe how generous you are with your help, thank you so much. If you have a donation website or URL where I can send a small token of appreciation, please feel free to share (as long as it’s not against community guidelines).