Smart Event API Calls – Updating Line Items on Sales Transactions

Have you ever wanted Intacct to update a corresponding custom field on a transaction line item based on another field? Have you ever wanted to update a field in a transaction’s line items based on a header level field? Those are two things I learned this weekend.

Problem 1: If you use Intacct’s merging transactions option in Order Entry to merge multiple Sales Orders to one Sales Invoice you might have noticed any custom fields on the Sales Order don’t propagate through to the merged Sales Invoice. This was especially bad news in this case because we had a custom invoice template set up which was grouping items and subtotaling based on that field. It didn’t make sense for the person entering sales orders to then also have to edit the merged sales invoice because Intacct clears those custom fields upon merging.

Solution: A Smart Event API call which looks at the Item’s name to fill out the custom field. The solution took some creative thinking. I noticed the list of items that require this custom field to be filled out either have a name containing: MAINTENANCE – S… or MAINTENANCE – U… So I thought I could write an API call with a condition so that if the Item’s Name starts with “Maintenance – U” the custom field is filled out with Unscheduled and if it starts with “Maintenance – S” the custom field is filled out with Scheduled. Neat, right?

Smart Event Condition:

Smart Event API Call Condition.jpg

This condition basically states that if the Item’s name starts with “Maintenance – S” then the API will fire. (The left 15 characters must equal this exactly – including case sensitivity).


Smart Event API Call.jpg

The API call was tricky because I wasn’t sure how to write it. I new that I needed to start with <update> because I’m updating the field. That’s easy. SODOCUMENTENTRY is the name of the object for any line item level details. (SODOCUMENT is what I had tried to use first because when I clicked object definition on the Sales Invoice it kept taking me here – turns out this object is the header level information on the transaction). When I went to the entire objects list I found the object name for the entries (SODOCUMENTENTRY). Then, RECORDNO I actually found in the Object Definition (see below).

Object Name Template - SODOCUMENTENTRY.jpg

From there it was pretty easy, I knew I needed the line numbers because I don’t want to update all lines with the same thing. MAINTE_TYPE was my custom field’s ID.

Problem 2: Having the Reference Number field on the header copy down to the Memo field on the Sales Order. (Unfortunately the memo field isn’t a field available in the “Defaults” section (see below).

Solution: Smart Event API call which fills out the Memo field with the Reference Number field if it’s not blank.


Smart Event API Call Memo Condition.jpg

API Call:

Smart Event API Call Memo Update.jpg

The only tricky part to this API call is the highlighted part. I was updating a line level field with a header field (separate objects in Intacct) so I had to write the correct field path:

SODOCUMENTENTRY : This is the line item object name

SODOCUMENT : This is the header level object name

PONUMBER : This is the field ID of the reference number on the header


Memo Field API.jpg

Two tricky workarounds that took some creative thinking but hopefully it helps someone else with writing API calls on transactions and their line items and saves some time!


2 thoughts on “Smart Event API Calls – Updating Line Items on Sales Transactions

  1. Hi Katherine,
    Hope you are doing well. I need your help for the following:
    We have added a custom field called ‘TRACKINGNUM’ to Sales order line item and Sales invoice line item. We create a sales invoice for a customer which would have all sales orders created by a customer during a week. We use Order Entry->Post Transactions to accomplish this. Is there a way to copy the value of Sales order lineitem custom field to Sales invoice line item custom field?


    • Hi Priyank, I apologize for not replying to your comment sooner. I haven’t checked this blog in a little while. There isn’t a way that I know of to copy custom fields when using the order entry post transactions feature. That is actually the reason I came up with the smart event api call for this post for a client. In my case though, the custom field was dependent on the item so I could use an API call. It sounds like yours varies from order to order and it wouldn’t be something you could do with a smart event.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s