Question

XML Message Error Handling

  • 12 December 2023
  • 3 replies
  • 46 views

Userlevel 3
Badge +9

So im using the XML below to add REQ_GROUP to new Tasks, works as expected, but generates an error where there is no Request, i.e. Project Task.  It doesnt seem to affect anything, but how do i capture this and not run the update? Thanks

<perform_batch>
  <hierarchy_select result_name="select_task01">
    <primary_table>task</primary_table>
    <attrs>
      <attr>task.task_id</attr>
      <attr>request.req_group</attr>
    </attrs>
    <from>
      <table>request</table>
    </from>
    <where>
      <join_constraint>
        <constraint>
          <left_operand>task.request_id</left_operand>
          <operator>eq</operator>
          <right_operand>request.request_id</right_operand>
        </constraint>
      </join_constraint>
      <data_constraint>
        <constraint>
          <left_operand>task.task_id</left_operand>
          <operator>eq</operator>
          <right_operand>@task_id</right_operand>
        </constraint>
      </data_constraint>
    </where>
  </hierarchy_select>
  <update_task>
    <task>
      <task_id xpath_node="//task_hierarchy_select_result[@result_name='select_task01']/task/task_id" />
      <user_def6 xpath_node="//task_hierarchy_select_result[@result_name='select_task01']/task/request/req_group" />
      <update />
    </task>
  </update_task>
</perform_batch>


3 replies

Userlevel 4
Badge +12

Hi @MartinF ,

If you are running this in a XML Business Rule, I would suggest you to follow the article below where we can use the validation xml section in the output params in the rule.

Also, you can create a custom view and join the view with the associated table’s custom metadata with a join relationship and then have the condition check in the rule input itself .

Userlevel 3
Badge +9

Hi @SAMLK 

 

Thanks for the response, however i dont have permission to view that article. Are you able to create it as an attachment please?

 

Martin

Userlevel 4
Badge +12

Validation XML

In validation xml, you can perform a hierarchy xml query. Simply add a hierarchy XML select query there (e.g: to check whether a request has at least one task)

If valid if found property is set to ‘Y,’ then it will execute the xml message (1st output parameter) if hierarchy query in validation XML returns at least one row.

Alternate XML

If no rows are returned by hierarchy query it will execute the alternate xml.

This works the opposite if you set valid if found property to ‘N’.

 

Or if possible just check the KB article

 

Reply