• Instructions to Ask a Question

    For any assistance, please click the "Ask a Question" button and select the Pabbly product for which you require support.

    We offer seven comprehensive applications designed to help you efficiently manage and grow your business:

    Our support team endeavors to respond within 24 business hours (Monday to Friday, 10:00 AM to 6:00 PM IST). We appreciate your understanding and patience.

  • Important: Any reported problems and issues with your integration will be reported to you and we will encourage the app developers help to resolve those integration issues.

How to Configure Request Body JSON of an Action Compatible with Line Item(s)

Status
Not open for further replies.
Line items in terms of accounting are subsets of individual items/products. For example, “quantity, unit price, amount” are line items of "Invoice".

If your app supports Line Item(s) like JSON structure which consists of an array of JSON objects as shown in below example:

JSON:
{
"Invoice": {
  "TxnDate": "2014-09-19",
  "PrintStatus": "NeedToPrint",
  "TotalAmt": 362.07,
  "Line": [
   {
    "Description": "Rock Fountain",
    "DetailType": "SalesItemLineDetail",
    "SalesItemLineDetail": {
     "TaxCodeRef": {
      "value": "TAX"
     },
     "Qty": 1,
     "UnitPrice": 275,
     "ItemRef": {
      "name": "Rock Fountain",
      "value": "5"
     }
    },
    "LineNum": 1,
    "Amount": 275,
    "Id": "1"
   },
   {
    "Description": "Fountain Pump",
    "DetailType": "SalesItemLineDetail",
    "SalesItemLineDetail": {
     "TaxCodeRef": {
      "value": "TAX"
     },
     "Qty": 1,
     "UnitPrice": 12.75,
     "ItemRef": {
      "name": "Pump",
      "value": "11"
     }
    },
    "LineNum": 2,
    "Amount": 12.75,
    "Id": "2"
   },
   {
    "Description": "Concrete for fountain installation",
    "DetailType": "SalesItemLineDetail",
    "SalesItemLineDetail": {
     "TaxCodeRef": {
      "value": "TAX"
     },
     "Qty": 5,
     "UnitPrice": 9.5,
     "ItemRef": {
      "name": "Concrete",
      "value": "3"
     }
    },
    "LineNum": 3,
    "Amount": 47.5,
    "Id": "3"
   },
   {
    "DetailType": "SubTotalLineDetail",
    "Amount": 335.25,
    "SubTotalLineDetail": {}
   }
  ],
  "DueDate": "2014-10-19",
  "DocNumber": "1037",
  "CustomerMemo": {
   "value": "Thank you for your business and have a great day!"
  },
  "Balance": 362.07,
  "BillEmail": {
   "Address": "[email protected]"
  },
  "ShipAddr": {
   "City": "Middlefield",
   "Line1": "5647 Cypress Hill Ave.",
   "PostalCode": "94303",
   "Lat": "37.4238562",
   "Long": "-122.1141681",
   "CountrySubDivisionCode": "CA",
   "Id": "25"
  },
  "BillAddr": {
   "Line4": "Middlefield, CA  94303",
   "Line3": "5647 Cypress Hill Ave.",
   "Line2": "Sonnenschein Family Store",
   "Line1": "Russ Sonnenschein",
   "Long": "-122.1141681",
   "Lat": "37.4238562",
   "Id": "95"
  },
  "Id": "130"
},
"time": "2015-07-24T10:48:27.082-07:00"
}

You can see in the above code, Line is an array of JSON objects. If your action allows this type of JSON structure then, you can set up Line Item compatible action of your app in Pabbly Connect.

All you have to do is, just declare the JSON Key that holds such dynamic data as in the above example "Line[{....}]" is the one.

1635764698578.png

Define one object of "line":[{....}] array in the Body Request (Raw JSON) with variables as shown below:

1635769637321.png

While defining the variables in the request body field on the action step, there is some syntax that helps Pabbly Connect to typecast the dynamic value of JSON as explained below:

For Numeric Value:
Use numeric# prefix in the variable as explained in the following example:

JSON:
{
    "tax": "numeric#{{tax_amount}}",
}

For Repeating Dropdown Values in all objects of Line Item array:
Use repeat# prefix in the variable as explained in the following example:

JSON:
{
   "item_name": "repeat#numeric#{{item_name}}",
   "amount": "repeat#{{amount}}"
}


For custom pabbly object

Used pabbly_object_ as a prefix for custom Pabbly object variables , Example -
JSON:
{
  "product_name": "{{name}}",
  "line": {
    "pabbly_object_fields": [
      [
        "{{key}}",
        "{{value}}"
      ]
    ]
  }
}
Pabbly object setting -
AD_4nXdq1FOY9gcFT4FoYp6qF2YHR4qujtx20FLCXc9AdlPEZ3iMbwxcTZ-dZs5fU2SAdVocEtdJ5Oh00-CrEVZ7tDu1mwxWP-sE1voTO8hJJXiUIpQh2EEPuygYI3j3sKvq6J9oo6fKDg

AD_4nXfhDeiOC5MpTfZKBzRwqZSbWSsOxaIFeOi3wUM1rB55FBoD5hg-LDGK7KNWdtFC0BqYpBBlGlZ3-labrwpk94U_FkLEn99G2qteNmcunWxTt3YJ3OFzWMca9Oerr4IsJ6VwMYBURA


Input for the pabbly object

1740396335919.png

Output -

1740396279776.png

For Root array -
Added option to support line itemizer on root level by passing array of object in root_array json key.
JSON:
{
    "root_array": [
        {
            "email": "{{email}}",
            "firstName": "{{firstName}}",
            "lastName": "{{lastName}}"
        }
    ]
}
Root array setting -
1741436868589.png


1741436910495.png

Output-
1741437111379.png

Once you configure the action with Line Item support, users will be able to enter or map comma-separated values for the line item fields as explained in this tutorial: https://forum.pabbly.com/threads/how-to-use-line-itemizer.1624/


Dynamic Keys With Line-Item Values using Pabbly Custom Fields​

(How to Generate Multiple Objects Dynamically inside the Line-Item)​


This document explains how to configure an action when you have the following situation:
  1. The field names (keys) are dynamic.
  2. The values for each key are provided as comma-separated line items.
  3. The system must automatically combine these values into multiple objects.
  4. The final output must be an array of generated objects.

This setup is required whenever you want to create multiple objects but the keys are not known in advance.



1. Enter the Dynamic Keys​

The first step is to ask the user to enter the keys (field names) as a comma-separated list.

Example input:

Name, Age, City

This means that each generated object will contain the following fields:
  • Name
  • Age
  • City
The keys can be anything. They are not fixed.
Whatever the user enters is what becomes the object fields.




2. Enter Line-Item Values for Each Key​

After entering the keys, the system automatically shows one input field for each key.

The user must enter multiple values for that key as comma-separated items.

Example:

For key "Name": Amit, Riya

For key "Age": 30, 25

For key "City": Delhi, Mumbai

Each position in the comma-separated list represents one object.

So:
  • The first value belongs to object 1
  • The second value belongs to object 2
  • And so on



3. How the System Combines These Values​


The system automatically combines values based on their position.


Example:

Index 0 (first values):
  • Name = Amit
  • Age = 30
  • City = Delhi
Index 1 (second values):
  • Name = Riya
  • Age = 25
  • City = Mumbai

This creates two final objects.




4. Final Output Generated by the System​


Based on the example inputs above, the system generates the following structure:

{
"rows": [
{"Name": "Amit", "Age": "30", "City": "Delhi"},
{"Name": "Riya", "Age": "25", "City": "Mumbai"}
]
}

Here:
  • The "headers" array contains the dynamic keys.
  • The "rows" array contains auto-generated objects based on line item values.
  • Each object is created by joining values using their index positions.



5. When This Setup Should Be Used​

Use this method whenever:
  • The keys are not fixed
  • The values for each key come as line items
  • You need to generate multiple objects
  • Each object must contain the same fields
  • The number of objects varies based on how many comma-separated values the user enters

This is the correct approach for any action where dynamic object creation is required and the data must be mapped using line-item values.




6. Summary (Beginner Friendly)​


  1. User enters the keys separated by commas.
  2. The system generates one input field per key.
  3. The user enters values for each key separated by commas.
  4. The system automatically creates one object per value position.
  5. All objects are combined into an array.
  6. No JSON needs to be written manually by the user.

1764143509209.png
 

Attachments

  • 1764143567783.png
    1764143567783.png
    198.4 KB · Views: 6
Last edited by a moderator:
Status
Not open for further replies.
Top