Create X Amount of Connected Records Based on a Number Field

The following demonstration will show you how to create X amount of connected Child records based on a Number field in the Parent table.

  • Not yet re-checked
  • Classic builder

Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

Screenshot for “Create X Amount of Connected Records Based on a Number Field”

The following demonstration will show you how to create X amount of connected Child records based on a Number field in the Parent table.

Step 1

Download the custom JavaScript pipe. Set up the parameters as seen below in a run serverside JavaScript call.

Screenshot for “Create X Amount of Connected Records Based on a Number Field”

Step 2

Add the following code to the request tab. Update your API keys.

Text
var appId = 'APP_ID';
var apiKey = 'API_KEY';
var apiSecret = 'API_SECRET';
var childTable = 'CHILD_TABLE_ID';
var childJoinFieldId = 'field_ID';

var parentRecordId = '{parentRecordId}';
if ('{flag}' === '{flagValue}') {
    for (let i = 0; i < {
            qty
        }; i++) {
        var settings = {
            "method": "POST",
            "headers": {
                "X-Tadabase-App-id": appId,
                "X-Tadabase-App-Key": apiKey,
                "X-Tadabase-App-Secret": apiSecret,
            }
        };
        var data = {
            [childJoinFieldId]: parentRecordId
        }
        var request = settings;
        request.method = 'POST';
        request.payload = data;
        UrlFetchApp.fetch("https://api.tadabase.io/api/v1/data-tables/" + childTable + "/records", request);
    }
}
Screenshot for “Create X Amount of Connected Records Based on a Number Field”

Step 3

Still editing the request-response, we will now update the child table ID and the field ID. The location of these values can be found here in the image below.

Screenshot for “Create X Amount of Connected Records Based on a Number Field”

Step 4

Add the following table rule to your parent table.

Screenshot for “Create X Amount of Connected Records Based on a Number Field”

Original Community post:

Create X amount of connected records based on a Number field - Community Discussions / Pipes - Tadabase Community

Was this page helpful?

Something wrong or missing on this page? Tell us.