Use Business Events
In Nimble AMS Spring '19 release, we introduced Business Events and included 9 stock business events for your association to immediately begin using.
For this current release, Business Events can NOT be created without errors. It is recommended to use the nine Standard Events of the Business Events feature to ensure the feature processes properly during the beta timeline. Please wait for the Summer '19 release to take advantage of this feature.
Stock Business Events
Here are the 11 business events you can begin to use:
|Business Event Label||Business Event (API) Name||Object||Event Type||Trigger||Description/Logic|
Community User Created
|Evaluates whether a user is a newly created community user, based on UserType. Uses the |
|Evaluates if a member is joining for the first time, based on the membership's stage (|
|Evaluates if a membership has lapsed today. As with all time-based business events, it is evaluated as part of a nightly job. When the account's |
|Evaluates if a membership has been reinstated, which fires if the account's |
Membership Type Changed
|Evaluates if a member's type was A (and A is not null) and has changed to B. Uses the |
Order Fully Upserted
|A lot happens in the system when an order is inserted or updated. This fires at the very end of the entire cart submission process, after everything else (memberships, registrations, etc.) have been successfully created/updated. Using this is an elegant way to have a process do something after an order is created or edited.|
Order Paid in Full
|Evaluates if an order had a balance and is now paid in full (i.e., the |
Payment Applied to Order Item
|Evaluates if payment line is an insert and not an update. Uses the |
|Membership Cancelled||MembershipCancelled||Account||EngagementEvent||DML||Evaluates if a membership has been cancelled. Uses the |
|Membership Order Item Cancellation||MembershipOrderItemCancellation||Order__c||TransactionEvent||DML|
Evaluates if a membership has been cancelled, by verifying if the Record Type of Order Item is
It is recommended for the first time users of the Business Events to subscribe to the upgraded type of business event i.e.; Membership Order Item Cancellation.
What are Platform Events?
The "Platform Event" is the larger category that each business event falls within, and when creating a process you'll need to select one before seeing the available business events for that platform event.
The platform events are:
- Engagement Event: Any activity-based occurrence in the system, such as a community user getting created, a membership lapsing, or a registration being canceled.
- Transaction Event: Any financial-based occurrence in the system, such as an order being processed, or an order balance becoming $0.
What are the Triggers?
Triggers specify if the business event was a data change, a time change, or something else:
- DML: Stands for Data Manipulation Language, and includes triggers like record creation, updates, or deletes. DML can reference an
Evaluationdirectly on the business event, or it can reference an
Evaluation Apex Class.
- Time Based: Includes any date/time based triggers. With this option, a date/time field on the object is referenced and a nightly job fires when the value in that field has elapsed.
- Custom: Reserved for complex criteria that is custom built.
Use Business Events
Business events are always used in the context of Process Builder. So you'll need permission to manage Process Builder, and you should also have a solid understanding of using Process Builder before proceeding. Learn more about Process Builder in this Trailhead trail: Automate Simple Business Processes with Process Builder.
Let's create a new process that posts to Chatter when an order is created/updated.
- Go to Setup | Process Builder.
- Click New.
Process Name. For
The process starts when, select
A platform event occurs.Show Me an Image...
Click the Add Trigger box, and set up the trigger as follows:
Platform Eventthat corresponds with the business event you want to use (see table above). In this example, it's
Objectthat corresponds with the name of the business event you want to use (see table above). In this example, it's
Be sure to select the Nimble AMS Order object (NU__Order__c), not the stock Order object from the Salesforce platform. The Process Builder interface doesn't distinguish the two unfortunately, so you should select one and then click the
Fielddropdown to make sure you selected the correct object.
Matching Conditions, we need to establish what links our platform event to the record we want to interact with. In this case, it's the business event:
Field, select the record ID for the object. In this example, it's
Be sure to select the correct ID field. You'll know you picked the true record ID field if the
Typepicklist changes to
ID. For example, the Account object has a text field named
Account Id, which will not work. For the Order object, its Name field is called
Order Id, which is also incorrect. You can quickly identify the wrong field because selecting one will change the
Typepicklist to something other than
ID, such as
Click Save to finish adding the trigger.Show Me an Image...
- Click the Add Criteria diamond, and set up the criteria as follows:
- Enter a
Criteria Namethat helps identify what the trigger is. A name based off of the business event generally makes sense. For example:
Order is Fully Upserted.
Criteria for Executing Actions, select
Conditions are met.
OrderFullyUpserted(This value depends on the business event you want to use as the trigger. Be sure to enter the business event's API Name, not its label. The API Name can be found in the table at the top of this page. For custom business events, the API Name can be found in Setup | Custom Metadata Types | Manage Records for Business Events).
Conditions, leave it as
All of the conditions are met (AND).
Click Save.Show Me an Image...
- Enter a
- Lastly, create actions, which can reference the order that fired the business event. For example, let's post to Chatter and reference the order name. Under Immediate Actions, click Add Action:
Action Type, select
Post to Chatter.
- Provide an
Action Namesuch as
Post Order to Chatter.
Post to, determine which Chatter feed to post to, such as
- When you click
Merge Field, notice how you can reference the order's fields and any related objects, just as you can with non-platform-event-based processes. Add some fields and a message.
- Click Save.Show Me an Image...
You can then activate this process and test to ensure that a Chatter post is created when an order is successfully created or edited.
By walking through this example, you should be able to see just how powerful business events are. You were able to bypass building complex logic or a large formula in the criteria diamond, and jump right to the actions you want to have happen when an order is created or edited!