Is there anyway to change a thing in the database when another thing in the database changes.
Here’s the situation:
I have a data type called “Job” with two important fields. One field is labeled “Job-status” whose data type is an option set, and the other field is called “Job-markers,” whose data type is a list of “Route-markers”.
The “Route-marker” data type has a field called “Pick-up-status,” whose data type is also an option set.
Here’s what I can not solve:
I have a page where I am displaying all Jobs that belong to the current user, along with the Job’s “Job-status” at the top, with the Job’s “Job-markers” as a list in a repeating group (which is a list of “Route-markers”). How can I automatically change the Job’s “Job-status” to a particular option set choice whenever the user changes all of the “Pick-up-status’s” within the “Job-markers” to a certain choice. For example, if a user changes all of the “Job-markers” to ‘scheduled’, then I would need the “Job-status” for that Job to automatically change to ‘scheduled’.
I’ve been trying back-end workflows, but nothing seems to work for this. Please help.
would it be ok to share a view-only link? its kind of hard to understand what you’re trying to do for someone who does not know the product. But from your description, I think you can do that with a backend workflow or do when condition is true, the condition being the trigger for the workflow. But you need to make sure that all changes to “job-markers” are reflected on the DB, not just frontend for that to work.
You have to set up a Database trigger on the Route-markers datatype.
Set it up to trigger when the This Route-marker’s now’s Pick-up-status is not the This Route-marker’s before’s Pick-up-status.
Add an action inside that Make changes to the Route-marker’s Job’s Job-status to “This Route marker’s now’s Pick-up-status”, but with the condition of Only if Route-marker’s Job’s Route-markers: filtered (Status <>This Route marker’s now’s Pick-up-status): count is 0
I tried implementing your solution, but I didn’t have any luck. I’m attaching some pictures and inserting a read only link to my app. Hopefully this will help shed some light as to what I have going on. (read only link is here Plentibytes | Bubble Editor)
I’m trying to change the “Job Status” to “Assign Driver” whenever the count of empty assigned drivers within route-markers (comprising the “Job-marker”) under the Job is greater than Zero.
So from my understanding, I tried to replicate the use case for you here and this is how it behaves, but the problem I see is that not every job status has a corresponding job-status, so the status in the workflow cannot be dynamic. You can add as many of these workflows as your use case requires.