Have you considered using Scheduled Processes instead of, or in addition to, Business Rules?
We have a few processes that perform similar functions:
Execute a Scheduled Process daily at 8 AM.The XML within the process either processes what we need or updates a value, or creates an event, on the relevant record. Subsequently, a Business Rule utilizes this event or value to generate notifications.
Sincerely,
-Rudy
Hi,
I drafted up the following to help get you started on this, there’s other methods, and the coding needs work, but I’m hoping this better explains how I would have set up the code in Scheduled Processes.
in this case I did statically code the dates - to make it dynamic, i’m not sure if there’s a code way directly in XML, but worst case validate against the view, which could add a SQL level constraint to only have results for Dispatches due “tomorrow”.
Again; just a draft - not tested - possibly not the final answer either.
<mass_update_c_sms_day_before_batten_installation>
<hierarchy_select result_name="csbbiv">
<attrs>
<attr>task.task_id</attr>
<attr>c_sms_day_before_batten_installation_view.*</attr>
</attrs>
<primary_table>task</primary_table>
<from>
<table>task</table>
<table>c_sms_day_before_batten_installation_view</table>
</from>
<where>
<join_constraint>
<constraint>
<left_operand>task.task_id</left_operand>
<operator>equi</operator>
<right_operand>c_sms_day_before_batten_installation_view.task_id</right_operand>
</constraint>
</join_constraint>
<data_constraint>
<constraint>
<left_operand>task.plan_start_dttm</left_operand>
<operator>gt</operator>
<right_operand>4/11/2024</right_operand>
</constraint>
<constraint>
<left_operand>task.plan_start_dttm</left_operand>
<operator>lt</operator>
<right_operand>4/12/2024</right_operand>
</constraint>
</data_constraint>
</where>
</hierarchy_select>
<c_sms_day_before_batten_installation>
<task_id xpath_node="//task_hierarchy_select_resultc@result_name='csbbiv']/task/task_id" />
<mobile_number xpath_node="//task_hierarchy_select_resultc@result_name='csbbiv']/task/c_sms_day_before_batten_installation_view/phone_number" />
<update />
</c_sms_day_before_batten_installation>
</mass_update_c_sms_day_before_batten_installation>