Question

FSM automatic Receiving ID

  • 18 October 2022
  • 1 reply
  • 67 views

Badge +5
I'm creating Purchase Orders for a place and after publishing the PO I would like it to create an automatic receipt, how can I do that?

1 reply

Badge +3

This can be done by an XML Business Rule. The Rule Input should identify the Purchase Order and the below XML will create and then post the Receiving record. You may want to add a relationship definition on the Purchase Order metadata to Receiving table so that the business rule input can check a Receiving does not already exist.

 

<perform_batch>
 <sequential_dependent>
  <validate_column default_data="false" column_names="purchase_order_id" regex_validated="true">
    <receiving>
      <purchase_order_id>@purchase_order_id</purchase_order_id>
    </receiving>
  </validate_column>
  <perform_initialize_receipt>
    <parameters>
      <place_id_to_rcv></place_id_to_rcv>
      <purchase_order_id>@purchase_order_id</purchase_order_id>
      <request_id></request_id>
      <shipment_id></shipment_id>
    </parameters>
  </perform_initialize_receipt>
  <hierarchy_select result_name="select_result1">
    <primary_table>receiving</primary_table>
    <attrs>
      <attr>receiving.receiving_id</attr>
    </attrs>
    <from>
      <table>receiving</table>
    </from>
    <where>
      <data_constraint>
        <constraint>
          <left_operand>receiving.purchase_order_id</left_operand>
          <operator>eq</operator>
          <right_operand>@purchase_order_id</right_operand>
        </constraint>
      </data_constraint>
    </where>
  </hierarchy_select>
  <perform_post_receipt>
    <parameters>
      <receiving_id xpath_node="//receiving_hierarchy_select_result[@result_name='select_result1']/receiving/receiving_id"/>
    </parameters>
  </perform_post_receipt>
 </sequential_dependent>
</perform_batch>

Reply