I have an app which has ‘shows’. shows have start and end dates. Each show has a ‘phase’, the main ones here are running and complete.
I have a daily scheduled backend workflow that runs 3 actions, the first to set any shows where the end date has passed to be complete, the next sets any where the closed date has passed to closed, and the last one sets any where the start date has passed to running if not complete.
These are using a considerable amount of WUs on something that is quite basic, is there a more efficient way of doing this?
There are a few thousand shows in the database but most are complete so do not need further processing
Yes, don’t do it. Just use the dates in your search for filtering by status…not really needed to change status if you already have the date values that are dictating the status.
The issue is i have dropdowns in the UI for currently running shows which take too long to load if loading and filtering on dates within the search. by using a status field this is much quicker there are other statuses as well which arent date related.
Hey! Instead of running the workflow on all shows, just search for shows where the phase isn’t complete or closed. That way, only active shows get updated, which saves a lot of WUs. Also, make sure each action has constraints so it only updates what actually needs changing.
Try with constraint using the current date, or just setup a database trigger change so it only runs those that need changing and skip the whole daily search setup
I’m not clear on if the WUs are from the searches or the making changes? im wondering if i shoud search once then run the updates on a single result set?
With data change events you would use constraints based on data before and after change, and considering your data doesn’t change, it’s not a viable option.
Your WU consumption is likely the search, just look at logs and dig into the charts to see where they come from.
You could consider a scheduled backend workflow to run on the date to make the status change as that will reduce the search.