Skip to main content
Skip table of contents

Salesforce Platform Events

Salesforce Platform Events is an event-driven messaging architecture enabling apps to communicate inside and outside of Salesforce. Events allow you to define custom data models (events) using Salesforce Object Query Language (SOQL) that suit your specific business needs. These events are essentially custom objects in Salesforce. Platform Events can trigger processes, workflows, Apex triggers, or external systems. For example, you can use a Platform Event to trigger a Flow or invoke an Apex class when a specific event occurs.

Platform event can be used to communicate when Dynamo API task has been completed. Event can contain task ID to connect it with Task API post request.

image-20240103-120049.png

Creating platform events

Since it’s the same as custom object, if one is not yet created, the following steps can be used to create Platform Events. Otherwise, an existing Platform Events can be used with new custom fields:

  1. Create a custom platform event by going to Salesforce Settings > Platform Events > New Platform Event

  2. Give it an object Name, such ad ‘Dynamo Event’ (The suffix '__e' will be added automatically to the given object name

  3. Create custom fields to hold post task values

  4. After a custom platform event has been defined in Salesforce, it is ready to be used in DAP logic. A platform event can be created with create command in the Flow. For example, if API template is used, the commands can be put in Exit step (in Exit Segment) so that a new Platform Event record will be created whenever the template flow is done

CODE
create type=Dynamo_Event__e
  field name=TaskID__c value=${dynamoAPI.taskID}
  field name=Error value=${error}

In the above example, custom platform event has the TaskID (TaskID__c) and Error (Error) custom fields.

  • TaskID field is used to store Dynamo API task ID which is also returned when posting the task through Dynamo API.

  • The Error field is used to report any errors. The Error variable is empty if no error occurred during the DAP run.

  • Custom events can be extended with custom fields to return required data from template logic, such as: created document’s ContentDocumentID, completed date, or any other values created within the template flow to communicate with Salesforce to trigger Salesforce Flow, etc.

Platform event triggered flow

Platform events triggered flow launches when a platform event message is received. This flow type can be used to handle Dynamo API task events.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.