Bot or API? Create new records in another table when a record is added to this table

Hello everyone,

I have been reading a lot of posts and trying to figure out the best way to accomplish this process.

I have a tables of work orders, maintenances, equipment, customers and (customer) locations. Each customer can have many locations and each location can have many equipment assigned to it. When a user gets assigned a work order that is a maintenance I want to be able to add a maintenance record for each of the equipment that is assigned to the location that the user is at so the user doesn’t have to create a new maintenance record for each of the equipment at that location.

I have this figured out:

And I know this formula selects the equipment that is assigned to the location from the rows of equipment

SELECT(Equipment[Key], ([Location] = [_THISROW].[Location]))

So what I tried to do was call a webhook with this body

{
“Action”: “Add”,
“Properties”: {
“Locale”: “en-US”,
“Location”: “47.623098, -122.330184”,
“Timezone”: “Pacific Standard Time”

},
“Rows”: [
“Work Order”: “<<[WO#]>>”,
<<START: SELECT(Equipment[Key], ([Location] = [_THISROW].[Location]))>>
{

“Customer”: “<<[Customer]>>”,
“Location”: “<<[Location]>>”,
“Location Name”: “<<[Location Name]>>”,
“Equipment”: “<<[Equipment Name/Location]>>”,

}
<>
]
}

Without success

With these settings

I was wondering if anyone could help point me in the right direction.

Another way to ask this question would be that when a user creates a new work order with the type selected as maintenance I want the app to look at the equipment table and say the location has 5 equipment(s) at that location I want the app to create a new row for each of those equipment(s) in the maintenance table so in this example create five rows.

Or to do this:

Thank you,

Josh

Your WO has to be inside of each row’s object

For doing this by actions instead, setup an add new row action on the equipment table, then use a reference action to execute the first action on each equipment that’s at the location.

3 Likes