Question

How to Set up a daily automation to activate the business rule each morning ?

  • 8 April 2024
  • 2 replies
  • 55 views

Badge +1

I need to send an SMS to the customer supervisor the day before each task is scheduled to start. I've set up a custom metadata view to prepare the SMS content, but I'm unsure how to schedule the business rule to trigger daily once and check if there are any tasks scheduled for the following day. Could someone provide guidance on how to set up this scheduling for the business rule?

 

 

attched ss is my business rule xml logic when there is task for tomorrow it will update the table and once it update an sms message will sent

 


2 replies

Badge +1

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

Badge +1

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_result[@result_name='csbbiv']/task/task_id" />
<mobile_number xpath_node="//task_hierarchy_select_result[@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>

 

Reply