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:
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).
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).
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.
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
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!