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 10 business events you can begin to use:

Business Event LabelBusiness Event (API) NameObjectEvent TypeTriggerDescription/Logic

Community User Created

CommunityUserCreated

User

EngagementEvent

DML

Evaluates whether a user is a newly created community user, based on UserType. Uses the CommunityUserCreatedEvaluation class.

Member Drop

MemberDrop

Membership__c

EngagementEvent

DML

EndDate__c != null && EndDateOverride__c != null && EndDateOverride__c < EndDate__c

Member Join

MemberJoin

Membership__c

EngagementEvent

DML

Evaluates if a member is joining for the first time, based on the membership's stage (Join means it's a new member). Uses the MemberJoinEvaluation class.

Membership Lapsed

MemberLapse

Account

EngagementEvent

Time Based

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 Lapsed On date field matches today's date, this business event fires.

Membership Reinstated

MembershipReinstated

Account

EngagementEvent

DML

Evaluates if a membership has been reinstated, which fires if the account's Join On date is updated to be after their Lapsed On date. Uses the MembershipReinstatedEvaluation class.

Membership Type Changed

MembershipTypeChanged

Account

EngagementEvent

DML

Evaluates if a member's type was A (and A is not null) and has changed to B. Uses the MembershipTypeChangedEvaluation class.

Order Fully Upserted

OrderFullyUpsertedOrder__c

TransactionEvent

Custom

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

OrderPaidInFull

Order__c

TransactionEvent

DML

Evaluates if an order had a balance and is now paid in full (i.e., the Balance is now $0.) Uses the OrderPaidInFullEvaluation class.

Payment Applied to Order Item

PaymentAppliedToOrderItem

PaymentLine__c

TransactionEvent

DML

Evaluates if payment line is an insert and not an update. Uses the PaymentAppliedToOrderItemEvaluation class.
Membership CancelledMembershipCancelledAccountEngagementEventDMLEvaluates if a membership has been cancelled. Uses the MembershipCancelledEvaluation class.


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 Evaluation directly 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.

  1. Go to Setup | Process Builder.
  2. Click New.
  3. Add a Process Name. For The process starts when, select A platform event occurs.

     Show Me an Image...

  4. Click the Add Trigger box, and set up the trigger as follows:

    1. Select the Platform Event that corresponds with the business event you want to use (see table above). In this example, it's TransactionEvent.

    2. Select the Object that corresponds with the name of the business event you want to use (see table above). In this example, it's Order.

      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 Field dropdown to make sure you selected the correct object.

    3. For 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:
      1. In Field, select the record ID for the object. In this example, it's Record ID.

        Be sure to select the correct ID field. You'll know you picked the true record ID field if the Type picklist 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 Type picklist to something other than ID, such as String.

      2. For Operator, select Equals.
      3. For Type, select Event Reference.
      4. For Value, select Record Id.
    4. Click Save to finish adding the trigger.

       Show Me an Image...

  5. Click the Add Criteria diamond, and set up the criteria as follows:
    1. Enter a Criteria Name that helps identify what the trigger is. A name based off of the business event generally makes sense. For example: Order is Fully Upserted.
    2. For Criteria for Executing Actions, select Conditions are met.
    3. For Set Conditions:

      FieldValue
      SourcePlatform event
      FieldBusiness Event
      OperatorEquals
      TypeString
      ValueOrderFullyUpserted (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).
    4. For Conditions, leave it as All of the conditions are met (AND).
    5. Click Save.

       Show Me an Image...

  6. 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:
    1. For Action Type, select Post to Chatter.
    2. Provide an Action Name such as Post Order to Chatter.
    3. For Post to, determine which Chatter feed to post to, such as This Record.
    4. 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.
    5. 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!