SamColburn
9 years agoQrew Trainee
Create Logs of Child Records with a Webhook?
So I want to keep track of various mixtures that we use and how much of them we use. Each mixture is composed of various materials that are entered when the mixture is made.
What I want to be able to do is when a usage log is created for the mixture, a corresponding material log is made for each material in that mixture.
Say for Example:
"Paint 1" is 50% "Red" and 50 % "Blue", so it has two child records "Red" and "Blue" related to those colors. Now I enter a log that says I used 2 gallons of "Paint 1". When I make that log, I'd like it to automatically create two logs in the materials log table, that say I used 1 gallon of "Red", 1 gallon of "Blue".
I feel like I should be able to do this with a simple Webhook, but I don't think that I can, because I have to search through the "Materials in mixtures" table to find the ones related to that mixture first, and then create records for those, which I don't think is possible in a Webhoook.
Am I missing something here or do I need to just go ahead and make some sort of script to handle this?
What I want to be able to do is when a usage log is created for the mixture, a corresponding material log is made for each material in that mixture.
Say for Example:
"Paint 1" is 50% "Red" and 50 % "Blue", so it has two child records "Red" and "Blue" related to those colors. Now I enter a log that says I used 2 gallons of "Paint 1". When I make that log, I'd like it to automatically create two logs in the materials log table, that say I used 1 gallon of "Red", 1 gallon of "Blue".
I feel like I should be able to do this with a simple Webhook, but I don't think that I can, because I have to search through the "Materials in mixtures" table to find the ones related to that mixture first, and then create records for those, which I don't think is possible in a Webhoook.
Am I missing something here or do I need to just go ahead and make some sort of script to handle this?