Discussions

Expand all | Collapse all

How to get webhook to fire for all records not just the first one to change

  • 1.  How to get webhook to fire for all records not just the first one to change

    Posted 03-22-2017 22:05
    I wrote a webhook and tested it by changing a flag field in a number of records (via gridedit). Unfortunately, only the first record was updated, all the rest were ignored. I assume my code is faulty, not repeating for all the changes in all the records?  
    1. The Source Table where the webhook resides is a connected CSV table
    2. The Destination Table is also Connected CSV (a different source file)
    3. I used EditRecord


  • 2.  RE: How to get webhook to fire for all records not just the first one to change

    Posted 03-22-2017 22:06
    The key field is not Record ID, it is [SOP+SKU] Field. 
    The record being updated is fid 127 in the destination table using the value in the [Order Status] field from the source table. 
    All this works correctly but for only 1 record at a time. I would have though it would fire on all changes?


  • 3.  RE: How to get webhook to fire for all records not just the first one to change

    Posted 03-23-2017 09:01
    I think for this you can use the %RepeatOn% and %RepeatOff% so that it picks up all the records.


  • 4.  RE: How to get webhook to fire for all records not just the first one to change

    Posted 03-23-2017 09:38
    You may also have to use API_ImportFromCSV.

    Use API_ImportFromCSV to add or update several records. You invoke this call on a table-level dbid. You can add AND update in the same API_ImportFromCSV request. (For an Add, leave the Record ID empty.)


  • 5.  RE: How to get webhook to fire for all records not just the first one to change

    Posted 03-23-2017 11:42
    I tried repeat but must have implemented wrong. I'll switch to API_ImportFromCSV and give that a try. Thanks.


  • 6.  RE: How to get webhook to fire for all records not just the first one to change

    Posted 03-23-2017 13:43
    Just another quick one.   I don't think you need the Key Field / Record ID in the header as for me that would just indicate a single record. Just thinking :)
    Have a look in the API.


  • 7.  RE: How to get webhook to fire for all records not just the first one to change

    Posted 03-23-2017 14:00
    Michael, I guess that is perhaps where I'm goofing up (Forgive me I'm new to this.)1. If I don't put the Key in there, how does the webhook know which record in the parent table to update? 
    2. Shouldn't the webhook fire one time for each record in the source table, rather than 1 time for 1 record and not for the rest?
    3. The "repeat" had made sense to me in the case it only fires once, but I wasn't sure how to implement that. I tried it but it did not work (probably because I did it wrong)
    4. Is there written documentation somewhere that shows how to do this stuff? I have looked at the PDF API guide, but it talks NOTHIGN about %RepeatOn% and other syntax issues. Perhaps I should be modeling this knowledge on some general language rules outside Quickbase, but I don't know where to look. I can learn it if I can just find the knowledge resource.

    Thanks!


  • 8.  RE: How to get webhook to fire for all records not just the first one to change

    Posted 03-23-2017 14:01
    I suspected that if I didn't the Key field in there it would ADD a record when I just want it to update existing?


  • 9.  RE: How to get webhook to fire for all records not just the first one to change

    Posted 03-23-2017 19:39
    In one of the webinars Kirk Trachy discusses webhooks around the 50 minute mark.
    You can view it here.  https://quickbase.webex.com/quickbase/onstage/g.php?RCID=0f84c132c8ee5cedca1ce94338ae3a7a

    Just click on playback and enter your email etc to view it.


  • 10.  RE: How to get webhook to fire for all records not just the first one to change

    Posted 04-04-2017 21:10
    I'd like to sit in on one of his webinars - where do i sign up to join the club?


  • 11.  RE: How to get webhook to fire for all records not just the first one to change

    Posted 04-05-2017 08:31
    http://www.quickbase.com/webinars
    There are also recorded webinars.   Very useful :)


  • 12.  RE: How to get webhook to fire for all records not just the first one to change

    Posted 03-23-2017 20:25
    Michael, That webcast was so helpful. It showed me I was doing it all wrong and went this route and it worked the first time!
    the Key is this: The "repeat" is put around the the top section only because the API is building a CSV table to hold the read data. Then the <clist> section merely writes all the data at once. That was confusing until the host explained that.
    Secondly, when the record ID is the one of the fields in the destination clist, it updates and if the record ID isn't there it adds. Very nice!

    <qdbapi>
    <usertoken>bxxxxxxxxxxxxxx</usertoken>
    <records_csv>
    <![CDATA[
    %RepeatOn%
    [new.SOP+SKU.csv],[new.Order Status.csv] <=== FIELDS you want the data from
    %Repeatoff%
    ]]></records_csv>
    <clist>6.7</clist>   <=== FIELDS DATA IS GOING TO IN THE TABLE ABOVE (LINK)
    </qdbapi>