Quite new to this, but encountered an issue left over by our developers on a business rule:
The business rule should update all related task_contacts with the information on request_contact when the request_contact is updated.
What we see is that only the first result from the hierarchy_select_result is being updated.
How can this business rule be improved to actually update all task_contacts on all related tasks?
BR:
<perform_batch>
<hierarchy_select result_name="NonCompletedTask">
<attrs>
<attr>task.task_id</attr>
</attrs>
<primary_table>task</primary_table>
<from>
<table>task</table>
</from>
<where>
<data_constraint>
<constraint>
<left_operand>task.request_id</left_operand>
<operator>eq</operator>
<right_operand>@request_id</right_operand>
</constraint>
<constraint>
<left_operand>task.task_status</left_operand>
<operator>ne</operator>
<right_operand>TECH COMPLETE</right_operand>
</constraint>
<constraint>
<left_operand>task.task_status</left_operand>
<operator>ne</operator>
<right_operand>COMPLETED</right_operand>
</constraint>
<constraint>
<left_operand>task.task_status</left_operand>
<operator>ne</operator>
<right_operand>CLOSED</right_operand>
</constraint>
</data_constraint>
</where>
</hierarchy_select>
<hierarchy_select result_name="TaskContact">
<attrs>
<attr>task_contact.task_id</attr>
<attr>task_contact.user_def3</attr>
<attr>task_contact.sequence</attr>
</attrs>
<primary_table>task_contact</primary_table>
<from>
<table>task_contact</table>
</from>
<where>
<data_constraint>
<constraint>
<left_operand>task_contact.task_id</left_operand>
<operator>eq</operator>
<right_operand>
<task_id xpath_node="//task_hierarchy_select_resultt@result_name='NonCompletedTask']/task/task_id"/>
</right_operand>
</constraint>
<constraint>
<left_operand>task_contact.user_def3</left_operand>
<operator>eq</operator>
<right_operand>@user_def3</right_operand>
</constraint>
</data_constraint>
</where>
</hierarchy_select>
<update_task_contact>
<task_contact>
<task_id xpath_node="//task_hierarchy_select_resultt@result_name='NonCompletedTask']/task/task_id"/>
<email_address>@email_address</email_address>
<first_name>@first_name</first_name>
<last_name>@last_name</last_name>
<home_phone>@home_phone</home_phone>
<mobile_phone>@mobile_phone</mobile_phone>
<phone>@phone</phone>
<user_def1>@user_def1</user_def1>
<user_def3>@user_def3</user_def3>
<user_def9>@user_def9</user_def9>
<user_def10>@user_def10</user_def10>
<user_def11>@user_def11</user_def11>
<user_def12>@user_def12</user_def12>
<user_def13>@user_def13</user_def13>
<user_def14>@user_def14</user_def14>
<user_def15>@user_def15</user_def15>
<user_def16>@user_def16</user_def16>
<user_def17>@user_def17</user_def17>
<user_def18>@user_def18</user_def18>
<user_def19>@user_def19</user_def19>
<user_def20>@user_def20</user_def20>
<user_def21>@user_def21</user_def21>
<user_def22>@user_def22</user_def22>
<user_def23>@user_def23</user_def23>
<user_def24>@user_def24</user_def24>
<user_def25>@user_def25</user_def25>
<sequence xpath_node="//task_contact_hierarchy_select_resultt@result_name='TaskContact']/task_contact/sequence"/>
<update/>
</task_contact>
</update_task_contact>
</perform_batch>