Overview

As an introduction to the capabilities of Customization Services, let’s create a Smart Event that executes an internal API call after an object is created.

Specifically, we want to grab a field value from a related object (the customer) and use it to update an object we just created (an invoice).

We’ll need a create a custom field to hold the information garnered via the Smart Event.

Create a custom field

You create a custom field in the Sage Intacct UI using the Custom Fields menu pick. For your reference, here’s an exported XML definition for the custom field on ARINVOICE used for this walkthrough.

<customField>
    <customFieldId>CUSTOMER_REP</customFieldId>
    <type>text</type>
    <ownerObject>arinvoice</ownerObject>
    <label>Customer rep</label>
    <page>Header</page>
    <dataDescription>
        <text>
            <length>50</length>
        </text>
    </dataDescription>
    <required>false</required>
    <description>For including Customer's sales rep</description>
    <hidden>true</hidden>
    <active>true</active>
</customField>

As you can see, the custom field’s ID is CUSTOMER_REP, and it is a hidden text field with a limit of 50 characters.

Create the Smart Event

You create Smart Events in the Sage Intacct UI using a wizard available via the Smart Events Catalog menu. The wizard walks you through each step of the process:

Conditions on the Smart Event

We want the Smart Event to be triggered only when the total due for the invoice is greater than 3000. You can use the Field Lookup button on the Smart Event wizard to choose the correct injection parameter for this, as shown:

({!ARINVOICE.TOTALDUE!} > 3000.00)

See the Sage Intacct product help for more information about writing conditions.

API body

The purpose of the Smart Event is to populate the CUSTOMER_REP custom field with the ID for the sales representative (CUSTREPID) for the related customer. We use an update_invoice API function whose key is the record number of the current invoice.

<update_invoice key="{!ARINVOICE.RECORDNO!}">
    <customfields>
        <customfield>
            <customfieldname>CUSTOMER_REP</customfieldname>
            <customfieldvalue>{!ARINVOICE.CUSTOMER.CUSTREPID!}</customfieldvalue>
        </customfield>
    </customfields>
</update_invoice>

The update provides a value for our custom field via an injection parameter that provides a path from the owning object to the related object to the desired field value.

Note: Be aware that injections work in the context of Smart Events, but are not supported in Web Services XML API calls that originate outside the Sage Intacct UI.

What’s next?

Provide feedback