Forum Discussion

AmirSohel's avatar
AmirSohel
Qrew Trainee
2 years ago

Creating Multiple Records with Webhook when Parent Record is Modified

Hi Everyone,

I want to create a webhook that generates a record whenever a record is modified. The scenario is as follows: Whenever a record (A) in the parent table is modified, I need to create a record in another table (C) for each child record (B) associated with the parent record.

I have a webhook set up on the child table (B), but it is only creating one record instead of creating records for all the child records. Let's assume we have parent record A with three child records. When parent record A is modified, the webhook should create three records in table C, each corresponding to a child record.

This is my webhook configuration:

  • Trigger: When a record is modified.
  • Additional criteria: Based on a particular lookup field.

Please provide any assistance or suggestions to ensure that the webhook creates records for all the child records whenever the parent record is modified.



------------------------------
Amir Sohel
------------------------------
  • I'm not sure that can be done with a webhook (I'm not real good with webhooks, so someone may correct me on that).

    However, that should be much easier using a Pipeline or Action. Have you tried either of those?



    ------------------------------
    Mike Tamoush
    ------------------------------
    • AmirSohel's avatar
      AmirSohel
      Qrew Trainee
      Thanks for your response!

      It's great that you mentioned using pipelines and actions as alternatives to webhooks.
       
       I also have a pipeline set up for similar purposes. However, I'm curious about the specific reason why a webhook may not be suitable for this particular scenario. Understanding the limitations or constraints will help us better assess the best approach.
       
      If you have any insights or experiences regarding the challenges of using webhooks in this context, I'd appreciate it if you could share them. It will contribute to our knowledge and help us make informed decisions.
       
      Looking forward to your response!


      ------------------------------
      Amir Sohel
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        I don't think the webhook has the ability to trigger on a Record in one table, and then go off and search for records in another table, and then, for each result, take an action like adding a record.

        and then, for each result, take an action like adding a record.

        However, a Pipeline is perfectly suited to do those steps.

        The first step would be a trigger step.

        The first step would be a trigger step.

        The next step would be the search for children were related parent is equal to the Record ID of the parent trigger record. 

        Then the last step would be a for each loop to create the children.  I am guessing that each parent doesn't have many children, say less than 25 children typically so  For Each loop would work fine.

        in a different used case if you were creating, possibly hundreds of records, there's a different technique using what is called a bulk upsert, but it's probably overkill for your use case.



        ------------------------------
        Mark Shnier (Your Quickbase Coach)
        mark.shnier@gmail.com
        ------------------------------