Create MANY things instead of creating a thing

Hello there!

So, I have my APP that in this section is where I upload the POLICY (insurance policy) and I want to create many things ( i have a data base that is called payments, in which each thing has the policy, due date, user, price)

Now, each policy has a different amount of payments. So I have a dropdown for selecting the amount of payments

So, in the example, if I set this policy has 2 payments

I would like to create a 2 different things in the “payments table” associated with this policy with default. So I can see in a repeating group the payments that are available for this policy

image

  • i did those two by clicking 2 times a button that says “create new payment for this policy” that is exactly what im trying to avoid.

How can I do that?

1 Like

You would use an API Workflow, and schedule it on a list - in this case your list may well just be numbers 1 and 2, or could be two dates.

The API workflow will create each thing for you.

Have a search on the forum, and in the references, and shout if you need more help.

Hey @martin2,

As Nigel suggested, the way to go about this is to Schedule an API Workflow on a List. If you install the Toolbox plugin, you can use the List of Numbers element (it gets added to your elements) to generate a list of numbers. Set the start number to 1, the list length to the value of that dropdown, and increment by 1.

Then, off a button click, Schedule the API Workflow on a List. The list being the value of this List of Numbers element. If a user selects 5, for example, the the list generated would be 1, 2, 3, 4, 5. With that, the API Workflow can be set up to create a new Payment (and anything else). For every item in the list, it will run that workflow.

I have a video on this action which can help walk you through it. Keep in mind that, in your case, your list is what I described above.

Check out the tutorial here: https://youtu.be/LLYaNHmt6_Y


Gaby | Coaching Bubble
Private coaching, courses, and tons of free resources

4 Likes

is the link correct?

Can APIS set different dates for every element created? also I will need to send different emails in different dates!

I updated the link (thanks)!

Yes, you can save different dates value to each Payment that is created. Depending on what the logic is for knowing the date, you can either set it directly in the API action or you can send a parameter to the API when you trigger it on the page to help calculate the date.

Sending the emails on those dates would likely mean having your API workflow schedule another API workflow. The first workflow would create the payment with date and schedule the second workflow for the result of step 1’s date. The second workflow sends the email.

Im missing the point where I connect the list of numbers with the api workflow…

I did the list of numbers thing as you said

But I don’t know how to tell the api workflow to create a different number of elements given. I only find the option to create one thing…

Where do I see create things from the list of numbers in here?

Or how do I link them?

You need to trigger it from the page with the dropdown, like with a button. When button is clicked > “Schedule API Workflow on a List”. The type of things will be number, and the list will be the value of that List of Numbers element. In that same window, you’ll be able to select the Endpoint you created.

For the endpoint action, you just want to have the “Create a Payment” action for a single payment. The way this all works is that you’re triggering this Endpoint for every number in the list of numbers. It’s a looping action. It will run as many times as there are list items. So if you select “5” in that dropdown, it will run 5 times. That’s why the endpoint shouldn’t be a change to a list, it would simply be to Create a Payment, which is what I had understood your goal to be. If the list is 5 numbers, then it Creates a Payment 5 times.

If you want to share your editor link, I can help out a bit more with the connections.

1 Like

Page Cartera

in group Polizas

Remember that for each payment, the only data they share is the same “insurance policy”, besides that, due date, payment # , and other things I want to attach in the future is individual and specific to each payment

I did the action with the button “crear vencimientos”

but the parameter is blocking me

NEVERMIND!!! JUST DID IT!!! THX @romanmg for this!!! you rock!!

image

Just for closing if you want to give me a tip on how to assign different due dates to each payment will close the thing super nicely!

In real world, from the beggining of a policy, let’s say you got it on January 1st, and you have it in a plan for 10 payments, you will have the duedate January 15, February 15, and on… How to tell this to the workflow so the dates are the same day, just one month in the future?

Not sure how to tell the workflow this (and make it automatic)
Uploading…

just the formula for making different dates for each payment with the api workflow at least pls! :slight_smile:

Lot’s of thanks! @romanmg

Hello there! just wondering if you could throw me a hint on how to assign different expiration dates to each payment! (I’ve tried the whole weekend to do it myself and failed…)

thanks really @romanmg !!!

Oh man, sorry I missed this.

Ok add a parameter to your API endpoint called “payment date” and it should be type Date.

Now, in the page workflow where you trigger the “Schedule API Workflow on List” action, you’ll have this new parameter that you need to fill out. Set it to “Current date/time +(month): This number”

So the result is this:

For Item 1 in your list, the pay date will = Today + 1 month
For Item 2, the pay date will = Today + 2 months
Etc.

In the API workflow, you can then set the payment date to = the value of the parameter.

Try that!

This topic was automatically closed after 70 days. New replies are no longer allowed.