How to use Line-items with Formatter#

Line-items are a special type of Zapier field that contain a list of multiple values (also known as an array). Many invoicing, accounting and form applications support line-item fields as a way to more easily represent their data. You can identify this type of field in Zapier when you look at the results of a Test Step and see a list of numbered rows. Here is a simple example with one value per line:

fruit

and a more complex example with many values per line:

lineprice-transform-1

Zapier will take this output and create line-item fields for use in the next Zapier Step, but what do you do when you need to transform each of the values in these line-item fields? That is where Formatter comes in, it is now "line-item" aware. Any transform that works on one field value will now work on all values in a line-item field. Here are some examples of how to use Formatter with these line-item fields:

Transform each Date in a Line-item Field#

Date formatting is very application specific, especially as you move between different geographies. Here is how to transform a line-item date field from a US date format to an EU format using the Formatter Date/Time Format Transform:

Trigger application provides line-item US dates:#

ldate-1

Formatter Step with date transform for EU date format:#

date-2

Results of Formatter Step with dates in EU format:#

date-3

Calculate Line Price for each Product Purchased#

Some online sales applications provide the quantity of each product purchased, the price of each product purchased, but no line price for each product. Here is how to accomplish that with Formatter, two line-item fields and the Spreadsheet-Style Formula Transform.

Trigger application provides line-item price:#

lineprice-transform-1

Trigger application provides line-item quantity:#

lineprice-transform-2

Formatter Spreadsheet-Style Formula Transform calculation that multiplies line-item values from each field:#

lineprice-transform-3

Results of Formatter Step (Quantity * Price):#

lineprice-transform-4

Currency Formatting#

Many invoicing applications are currency agnostic, so if you need to take those generic invoice amounts and format them for a specific currency, here is how you would do that with Formatter, a line-item field and the Format Currency Transform:

currency-transform

Transform SKUs from an Online Sales Application to an Invoicing Application#

Many invoicing applications require the use of their specific product SKUs. Many on-line sales apps generate their own unique product SKUs. How do you then, match the product purchased with the product invoiced? Formatter's Lookup Table Utility and line-item fields, that's how:

 

Add Shipping Information to your Invoice using the Append to Line-item utility#

Some e-commerce applications provide shipping as a separate item, with its own set of fields. Many invoice applications want shipping as a standard line in the line-item fields your Zap provides. The Formatter Append to Line-item Utility can facilitate this by appending the shipping value(s) to these standard line-item fields (in this case, Description, Quantity and Price). You'd need a Formatter Append Utility Step for each of these fields, like this:

Append Shipping Description Description

Append Shipping Quantity Quantity

Append Shipping Price Price

You then use the output of these Formatter steps in the Invoice Step:#

invoice step

The output of those Formatter steps would create the line items in the invoice, including shipping:#

quickbooks invoice

Create your own Line-items for an Invoicing Action using the Text to Line-item Utility#

Not all Trigger apps are capable of providing data in line-item format (in order to add lines to an invoice Action, for example). Luckily, we have a way to do it using Formatter's Text to Line-Item Utility....

Let's say you need to create multiple line items in an invoice with the following information:

Description Qty Price
Blue Shirt 2 10
Pink Shirt 3 12
Green Shirt 5 14

You'd need to add 3 Formatter steps to convert that data into the Line item format that the Invoice Step needs.

Here's how each step would look:#

Description:

Formatter step showing how the description line item is created

Price:

Formatter step showing how the price line item is created

Quantity:

Formatter step showing how the quantity line item is created

You then use the output of these formatter steps in the Invoice Step:#

Xero step showing how the newly created line items come into play

The line-items are then part of the invoice:#

Invoice created in Xero showing multiple line items based on the previous formatter steps

Create a Tag Text Field using the Line-item to Text Utility#

There are some instances when you need your Line-item field as formatted text so it can be used in an Action that doesn't support line-items. This is sometimes referred to as "flattening" a line-item. Tags are an instance of this, as it seems each application uses their own format to delineate multiple tags, and most don't support line-items. Hubspot is an example here, it uses a string of text, with each tag delineated by a ; Here is how you'd get this Tag format for Hubspot using the Line-item to Text Utility:

The Trigger application provides Tags as a line-item field, in this case a product category tag:#

category

Let's run the category field this through the Line-item to Text utility, replacing the , with ;#

tags

Now we are ready for the Hubspot Create/Update Contact Step to add this to the tags field:#

hubspot step

The tags are now part of newly created Hubspot contact#

hubspot

↑ Was this documentation useful? Yes No (Suggest Edits)
Get Help