I have a call records app. For each missed call I look if there is another call that returns the missed call:
get missed calls from a view (collected records)
for each collected record, check if there is a record that returns the call (limit to 1).
Now when I update the collected record from step 1 with data from step 2, I seem to have no native way to differentiate between results from 1st and 2nd step?
Unfortunately, I don’t believe this can’t be done in a purely no-code way because the second collection step overwrites (or merges with) the results from the first collection, making it impossible to differentiate between them.
Since you’re likely getting multiple missed calls from a view and then looping through them, you’ll need to:
Build an array of all the record_ids from your first collection into a var variable at the start - something like:
The [] after the record_id means that JSONata will deliver an array of record ids even if there is only one
2. Loop through that var_records array
3. For each record_id in the loop:
Search for the returning call
Use tape.record.update() with the current record_id to update the missed call record
Clear the collection
This way you’re not dependent on the collection that gets overwritten during each loop iteration.