AnsweredAssumed Answered

How can I determine uniqueId of main feature using webhook response?

Question asked by on Aug 6, 2018
Latest reply on Aug 8, 2018 by

This is an easy task if you don't have repeats. When you introduce repeats, you get multiple addResults that each have an attribute of uniqueId (see attached and it is not easy to tell which one belongs to the main layer and which ones belong to related tables. In the case of the attached results, the uniqueId is 3. It is different if there are no repeats (see attached


What logic can I use to write code that gets the correct uniqueId every time? Below are 3 approaches I'm considering.


Approach 1

Use the addResults with id: 0. That is the case in the 2 attached examples. Is that always true? Does id: 0 always reference the main layer and subsequent ids represent related tables? If that is always the case, then that is pretty simple.


Approach 2

If there is only 1 addResults then use the uniqueId of that addResults

If there is more than 1 addResults, then look up the parentglobalid in the adds and use that to lookup the globalId of the correct addResults. This is a little complicated, but should work.


Approach 3

Use layerInfo to get the id of the correct addResults. I have results from a webhook from a while ago that included layerInfo attributes, which included, among other things, the id of the layer. For some reason that is not included in the webhook responses, we get now. Any thoughts on why? It seems like this would be the best approach if we could be could get it turned back on.




Thanks so much!