...
Navigate to Setup
Expand the section Process Automation
Click the link Process Builder
Click the button New
Enter the Name for your new Process
Select that the process starts when A Platform Event Message is received
In your newly created process, click Add Trigger
Search for the Platform Event “OptimizerVersionActivationCompleteEvent”
Select the object “Optimizing Version“
Setup the following matching conditions
Press Save
You can add further criteria for when the process should run, as a default however you can select No criteria—just execute the actions! and give condition a name
Now select an Action. In order to trigger the pre-invoice generation select Apex → ADvendio__GenerateInvoiceController. Set the Apex variables as follows
Your process should look as follows (including any other additional criteria you may have added)
...
Navigate to Setup
Expand the section Process Automation
Click the link Flows
Click the button New Flow
Select the ADvendio Optimizer OptimizerVersionActivationCompleteFlow template
The Flow template comes with a pre-created Apex Action that will generate the PreInvoices for a given Media Campaign.
Create a new Flow adding any custom logic you wish to trigger based on the Platform Event “OptimizerVersionActivationCompleteEvent”
In order to invoke the Flow from the process, go back to the process and delete the Apex Action you created earlierCreate a new Flows Action which will invoke the Flow you just created
If your Process was already activated, you may need to clone it before you can make these changes
You will also need to pass the Media Campaign ID to the Flow, as you can see below
Activate your new process
...