Discussions

Expand all | Collapse all

Webhook or action to create parent record on child import

  • 1.  Webhook or action to create parent record on child import

    Posted 09-25-2017 22:56
    We have a temporary app where order records (line items) are imported into a table. I am trying to use an action/webhook (since I can't program Javascript) to create the parent record so that I can create summaries of records that meet certain requirements.  Summary Tables are somewhat helpful, but are showing great limitations in what I'm trying to accomplish.

    I tried an action to create a record but got an error stating I was using non-unique values...I thought after it added the first record via the action it would simply update it if the second line had the same record ID. Instead it threw an error. (API_ImportFromCSV) If you use update record instead of import or add and the record ID doesn't exist will it create it?


  • 2.  RE: Webhook or action to create parent record on child import

    Posted 09-25-2017 23:10
    Can you describe your ACTION setup?


  • 3.  RE: Webhook or action to create parent record on child import

    Posted 09-25-2017 23:14
    When order line is added, then add a record to the parent table.
    Values: Copy the value from "Order Number MOS" which is a formula field that holds the order number to "Master Order Number" which is the Key Field of the parent table. In my test data, I through error 51. because I had two lines that had the same order number (because an order can have multiple lines). I was hoping it would just overwrite the new record...but I think Add has to be unique.?


  • 4.  RE: Webhook or action to create parent record on child import

    Posted 09-25-2017 23:35
    Hmm, I don't know if that can be made to work, but before we give up a nice native solution,  one thing to try would be to have a field on the Parent called [Parent Exists?] as a formula checkbox field with a formula of true.  just type true on the box.

    Then look that up down to the child table.

    Then add a condition on the ACTION to not fire of the [Parent exists?] is checked.


  • 5.  RE: Webhook or action to create parent record on child import

    Posted 09-25-2017 23:51
    IT seems that it checks the criteria one time then ran the entire thing instead of each time it was going to add a record..


  • 6.  RE: Webhook or action to create parent record on child import

    Posted 09-25-2017 23:51
    so the same error occurred.


  • 7.  RE: Webhook or action to create parent record on child import

    Posted 09-25-2017 23:59
    OK, so I suggest we abandon that approach and move to Plan B.  But my plan B is pretty manual.

    Make a Summary Report of Order Lines where [Parent Exists?] is unchecked.  Group by group by [Order Number MOS]

    Then use More ... and copy these to another table and navigate to the app itself again and then to the orders table.

    You can then subscribe to receive that report daily so you remember to make the parents.


  • 8.  RE: Webhook or action to create parent record on child import

    Posted 09-26-2017 00:06
    It seems as though webhooks/actions should be able to either a) add the record or b) update if it already exists?


  • 9.  RE: Webhook or action to create parent record on child import

    Posted 09-26-2017 00:11
    I think that the issue is that even if you manually import a CSV file with a duplicate Key within the imported data, it will fail.  

    Yes, if the Key exists it will update and if the Key does not exists it will add.  But if you try to import data with duplicates within the import set in the Key it will fail, so I think that the ACTION / WEBHOOK is just an automated version of the manual process.

    So, I don't know how to do that without a script as they would need to be added one by one after checking if they exists or else added one by one one record at a time so that there is no way that the import record set of 1 record can have duplicates within the set.


  • 10.  RE: Webhook or action to create parent record on child import

    Posted 09-26-2017 09:26
    Thanks. So Manual it is until I get frustrated enough to get a script written. Thanks for the education :)