Update a Data Field based on index change for whole dataset

Hi, I have project based on a barber shop

  1. Users get added as Customer of the store when they join click Join Quue
  2. Current index of customer is assigned as the data field of Position.
  3. When a new customer is added, i want to be update the existing customers’ Position with their new current index

Note: Same with when customer is removed that is infront of them in the queue, since their position will be changed. That why, I can call from the database the current user’s position from another screen.

I have tried alot of methods, but have all failed. Is this perhaps a Custom Event. Also, how do i trigger an update off the entire dataset not just one field?

Thanks in Advance

You need “Schedule a Workflow on a list” from the Custom Event group.

You will need an API Workflow that takes a single Customer thing, and subtracts 1 from the position.

Then schedule that Workflow on the list of ALL Customers … and then should all have 1 subtracted from their Position.

Considering that the position is always changing, it might make more sense not to store it, but to calculate it, say based on a sort of created datetime or modified datetime.
Then you can do a search with a sort and get first item or last item.
Repeating groups create their own “cell current index” if you need to display the position.