Jump to content

Platform Trigger - Consolidated Line Quantity Totals


 Share

Recommended Posts

  • Members

Submitter: Anonymous

Business Need: Below is an example of how to use formulas in a Platform document template/trigger to sum up a field in Purchasing line items and place the total in a custom field on the header of the purchasing document.

Pre-Requisite: Ensure that Platform Services are enabled for your account.

Tool Limitations:

  • Run in offline mode only

FAQ's:

  • None

Installation Steps:

  1. Navigate to Platform Services->Objects.
  2. Search and select the object for your purchasing transaction definition making sure that the integration name is PODOCUMENT.
  3. Navigate to the Platform document templates section and create a new template.
  4. Give it any name and any template type. For the template body, use the below and save the template:
<update_potransaction key="{!PODOCUMENT.DOCID!}">
  <customfields>
    <customfield>
      <customfieldname>TOTAL_QTY</customfieldname>
      <customfieldvalue>#EVAL[ var total = 0;
      {!#LOOP_BEGIN.all#PODOCUMENTENTRY@DOCHDRID@[email protected]!}
      total += {!PODOCUMENTENTRY.QUANTITY!}
      {!#LOOP_END.all!}
      return total; ]</customfieldvalue>
    </customfield>
  </customfields>
</update_potransaction>
  1. Navigate to the trigger section and create a new trigger of type ‘Intacct API‘.
    • Make sure the trigger is deployed.
    • Select the trigger activations needed. (Minimum should be ‘After create’)
    • Give the trigger a name.
    • Check the ‘Run offline’ checkbox.
    • For the Document template, choose the template created in step 4.
    • Save the trigger.

Fields:

  • TOTAL_QTY custom field on header level of purchasing transaction in scope

Usage Steps:

  • Create purchasing transaction with multiple line items and quantities
Edited by Sterio, Louis
Link to comment
Share on other sites

  • Sterio, Louis changed the title to Platform Trigger - Consolidated Line Quantity Totals
  • 4 months later...
Posted (edited)

Hi Louis

I am trying to implement this trigger on creating a Picking Slip in Order Entry and the trigger is failing with the following error :

Illegal format for Picking Slip : Total Weight Error: Syntax error in formula SOURCE: Template Total Weight - IntacctAPI. [Support ID: dLEB5EB042%7EZlcpuP0R4E8-D2aWkMhUPAAAABk] Validate sodocument record failed! Could not create sodocument record! Could not Set Document record! Illegal format for Picking Slip : Total Weight Error: Syntax error in formula SOURCE: Template Total Weight - IntacctAPI. [Support ID: dLEB5EB042%7EZlcpuP0R4E8-D2aWkMhUPAAAABk] Validate sodocument record failed! Could not create sodocument record! Could not Set Document record!

The trigger is deployed, set as offline and trigger is After creating | After updating

Template (marked as private) :

<update_sotransaction key="{!SODOCUMENT.DOCID!}">
  <customfields>
    <customfield>
      <customfieldname>TOTAL_WEIGHT</customfieldname>
      <customfieldvalue>#EVAL[ var total = 0;
      {!#LOOP_BEGIN.all#SODOCUMENTENTRY@DOCHDRID@[email protected]!}
      total += {!SODOCUMENTENTRY.UNIT_WEIGHT!}*{!SODOCUMENTENTRY.UIQTY!}
      {!#LOOP_END.all!}
      return total; ]</customfieldvalue>
    </customfield>
  </customfields>
</update_sotransaction>

TOTAL_WEIGHT is a custom field on SODOCUMENT (number)

UNIT_WEIGHT is a custom field on  SODOCUMENTENTRY (number).  The UNIT_WEIGHT is updated when creating a sales order, and I can confirm that the UNIT_WEIGHT is updated before we convert to a picking slip.

Are you able to assist?

Thank you

 

Edited by Susan Keith
Link to comment
Share on other sites

 Share

×
×
  • Create New...