How to create a list of things related to, and after, creating another list of things through an API?

I’m creating emails related to a user using an API workflow. This is working.

image

Next, each email could have multiple attachments related to it. This requires a separate API call to get the attachments related to the email. So, I’m looking for a way to combine both API calls in order to create an email and then create the related attachments, then moves to create the next email.

  1. Create email
  2. Create related attachments
  3. Create email
  4. Create related attachments

If that’s not possible, is there a way to look at a table/data type and when it’s updated with a new thing (e.g. email), could that trigger the creation of a different thing (e.g. attachment)?

Hey @Kfawcett, have the first API workflow trigger a custom event with type of thing = email. That Custom Event could run the creation of attachments related to the “Current Workflow Email”.

SInce you’re doing Schedule API Workflow on a list to create each email, those will in turn each trigger this custom event every time.

The “Create a new Attachment” in the screenshot is just an example, but I’d assume you can have this be your API call to create the multiple attachments.


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

2 Likes

Thanks Gaby! This put me on the correct path. Not sure why I didn’t think about adding it in the API workflow.

I didn’t need the Custom action. Instead, I put the Schedule API workflow inside of the Create Email endpoint.

image

I was then able to reference the Result of Step 1 email ID in my GetAttachment API call to find the related list of attachments. :slight_smile:

2 Likes

Hi, @romanmg ,
I have a similar question but don’t know how to achieve the goal, will you help me with this, too?

I have 2 data types:

  1. ExpenseItem
  2. ApprovalProcess

There are 2 API workflows, 1 for creating ExpenseItems, and 1 for creating ApprovalProcess.
Normally a user would create multiple ExpenseItems first, then send for Approval.
At the moment I’m using the 2nd API workflow to create ONE ApprovalProcess for all ExpenseItems, how can I make it so the 2nd API workflow would create the same amount of ApprovalProcesses of the ExpenseItems, and attach them 1-by-1?
Much appreicated!

By the way, these 2 workflows are triggered by 2 separate popups.
That’s where I’m stuck, because they’re not in the same workflow so I cannot do the “result of step 1” thing.