ChatGPT and Intacct Platform Triggers

“Citizen developers” is a term often used today to describe individuals who leverage low or no-code options for customizing business applications without requiring IT involvement. AI, like ChatGPT, is actively aiding Citizen Developers by breaking down the barrier of entry to writing custom code. Today we’ll walk through how to pair ChatGPT with Intacct Platform Triggers.

First, what are Platform Triggers?

In Release 3, 2022, Intacct made Platform Triggers generally available to standard objects (previously only available on custom objects). Triggers, like Smart Events, automate tasks upon a certain event’s occurrence. However, triggers are different from Smart Events in a couple of ways. First, not only can you select add, set, or delete actions but you can also choose whether the trigger occurs before committing the record to the database or after.

Events that can initiate a trigger:

  • BEFORE CREATE
  • BEFORE UPDATE
  • BEFORE DELETE
  • AFTER CREATE
  • AFTER UPDATE
  • AFTER DELETE

In addition to different events, triggers also allow for new action types.

Trigger types:

  • Intacct API
  • HTTP Post
  • Send Email
  • Validation
  • Run Triggers on Related Objects
  • Create New Record
  • Update Field Value
  • Attach Related Record

How do we apply these Platform Triggers and ChatGPT to a business use case?

In our use case, we’d like to post a journal entry to record commission based on the amount of a sales invoice. The first step is to calculate the amount of commission to post per invoice. Queue Platform Triggers. We’ll create a Platform Trigger on the Sales Invoice Header object that uses the BEFORE CREATE and BEFORE UPDATE events along with the Update Field Value action to perform a computation using simple JavaScript to update a custom field.  

How do we build it?

First, the new custom field:

We will add a custom field called “Commission Amount” to the Sales Invoice Header object by going to Platform Services > + Custom Fields. 

Now, let’s add the platform trigger to populate the new field:

First, navigation: from the Order Entry Transaction screen, go to More Actions > Object definition.

Click Triggers (top component list shortcut).

Then New trigger.

Next, select the trigger type “Update field value” and Next.

On the next page we’ll select the following properties:

  • Trigger is Deployed – this activates the trigger. It can be deactivated at any time in the future by unchecking this box.
  • Trigger Activation – In our use case, we would like the commission field to be updated both before create and before update.
  • Trigger Name – UPDATE COMMISSION AMOUNT (not quite as finicky as smart events – these names can have spaces!)
  • On Field Change – We’ll select Any Update to keep things simple here. However, you could have a trigger fire only upon certain fields being changed (a great example: information on a Vendor being changed could trigger an email)
  • Record – should be already selected if you navigated from the sales invoice screen to the appropriate transaction definition.
  • Field to Change – We want to update the new custom Commission Amount field.
  • Change Value Formula – this is where we’ll leverage a little of Intacct’s help and ChatGPT.

Queue my conversation with ChatGPT:

Thanks to ChatGPT (thanking AI is always key) and a little of Intacct’s help guide I know the formula I need is: 

As ChatGPT is not always right, it’s important to use Intacct’s help guide as well as the two steps available for debugging prior to saving the trigger and deploying it (and yes, always build and test in a sandbox first):

  1. Validate the syntax is correct. After clicking the magnifying glass, the green box around my formula signifies a correct formula. 
  2. Debug by selecting an existing transaction to verify that the formula is evaluating as expected and returning the correct value. This magnifying glass brings up a new window which displays how the formula is parsed and the result for a specified transaction.

Lastly, let’s watch the new Platform Trigger in action!

(Yes, those are expensive binders and paper reams).

Final thoughts and what’s next?

While platform triggers do open up a wide array of options that were previously not available (hello JavaScript to compute formulas!), they do have limitations that ensure Smart Events will not yet completely be fading into the background. Namely, Platform Triggers that update fields cannot always traverse related objects. For example, I cannot populate a custom field on the Sales Invoice from a Customer, so yes you’ll still need this smart event to populate a tax ID or sales rep name on an invoice. Curious about other applications for triggers or have a use case you would like us to help test? Reach out to your Sage Intacct team! 

Now that ChatGPT is writing code for us, and putting together our vacation itineraries, maybe we’ll all have a littler more time to attend webinars like our next one on Smart Events and Smart Rules on Tuesday, October 31st. Curious about other applications for triggers or have a use case you would like us to help test? Reach out to your Sage Intacct team! 

  • 571-227-9512

Kathy Jastrzebski is a manager with CLA’s Intacct team. CLA is an Intacct Premier Partner with a partnership that spans over 20 years and more than 1,000 successful implementations. Kathy brings five years of accounting experience along with seven years of Sage Intacct implementation experience. Along with her accounting experience, she has a passion for leveraging technology to lead finance teams worldwide through system implementations with a mission of increasing department efficiency through business process improvements.

Comments

Thank you for the article. I appreciate that you didn’t say the use of ChatGPT was possible, but that you went step by step to demonstrate how it can be used in a real scenario inside of Intacct.

Thanks Kathy, so cool! Leveraging these kinds of functions reduces repetitive manual effort and allows us time to focus on the larger picture.

Very insightful.

Awesome job, Kathy!

Is Intacct compatible with Zapier? If so, that might make a nice article, as well!

Thank you for this article Kathy! To second what another commenter said, “…I appreciate that you didn’t say the use of ChatGPT was possible, but that you went step by step to demonstrate how it can be used in a real scenario inside of Intacct.” The step-by-step instructions were very helpful. Prior to reading this, I had never created a Trigger and never written anything in JavaScript — not that I would have a clue to go about it. It took some machinations and a lot of conversation with ChatGPT before I got what I needed, which I ultimately solved by a combination of the ChatGPT responses and looking at the details you provided above. I’m probably more excited than I should be, but I genuinely appreciate anyone who can make easy work something that feels intimidating and very complex.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*