I’m trying to write a fairly complex (I think) server action that will update a field in some other records (different from the one being sent) when the user posts (update or insert) to it.
The concept is to keep the Priority field unique. If the user sets the Priority on a given record to a value that’s already in the table, I need to increment the value for all the other records.
I have it defined like this:
The first query (check_tasks) does a count of records where the id does not match and the Priority does match. The condition then checks that there is at least one record that matches. The second query (get_tasks) gets the records where the id does not match and the Priority is greater or equal to the POSTed Priority. From there, I’m trying to loop over the results and update the records that meet the criteria.
But it doesn’t work. No errors, just doesn’t do what I think it should. Is there anything obvious or some way of debugging to see where it’s breaking down?
Edit: Forgot to ask the one question. I need to increment the PriorityValue for each loop in the repeat, but can’t figure out how to do it. What is the proper way of doing that?