Forum Discussion

RyanHuffman's avatar
RyanHuffman
Qrew Cadet
9 years ago

Webhook Iteration Count?

Is there any way to keep track of the number of iterations when running a repeat section in a webhook? I have a number of records that can be added with a grid edit so there may be multiple records created at once. When they are created, I am trying to create a webhook that will give each a different number in a particular field but the numbers cannot be unique to the table because the records are child to a parent table and the numbers for each child belonging to a parent will be independent of children belonging to other parent records. As an example, if a user added two records in grid edit, one needs a "1" in the field and the second needs a "2" in the field. If I can track iteration numbers in a webhook repeat, then this would be simple but I cannot figure out how to do so. If I cannot do that, any suggestions? Thanks!
    • RyanHuffman's avatar
      RyanHuffman
      Qrew Cadet
      The purpose is to set the number fields in all newly created records, yes. I realize it probably sounds like an overly complicated way to achieve something so simple but I am designing this site in an attempt to mirror functionality of an old site as closely as possible (at least for the time being) to assist users with the transition period. This is a result of that but I am open to other suggestions as well.
  • Do you need to handle deletions of records as well? One solution is just a summary field of "# of records" on the parent, pass it down as a lookup and snapshot it. Then have a formula that does snapshot + 1.
    • RyanHuffman's avatar
      RyanHuffman
      Qrew Cadet
      There is no need to deal with deletions in this process. It's difficult to determine how multiple records added through grid edit are handled by the system but when I do it this way, all of the numbers end up being the same (2). It seems like all grid edit records are created at the same time, as with a API_ImportFromCSV so at the time of the snapshot, all lookups are equal to 1 (adding one to that leads to the 2 I am seeing).