Set two variables from a SF trigger, custom subscription.
Run 1 of 2 data flows based on which variable has a value. For example, if Message_c contains a URL, I run data flow 1, if Message_c is empty, I run data flow 2.
Please let me know if you need any additional information. Thanks!
Both of these can be accomplished in the End Point Actions you can see on the right hand side of the studio when working with a Salesforce subscription.
First you’ll want to set the Session Mapping for this subscription, so as an example, mine looked something like this:
With the Salesforce response, you’ll want to use the keyword “event” to access the returned data. In the screenshot below I’m capturing the Id and the MobilePhone values but those are dependent on your salesforce object you’re working with.
Everything else if just through conditions on the endpoint actions. I put a dummy version of what that could look like in the screen shot.
Personally I would test this out using a request catcher to make sure you’re accessing the data you need before using them in the studio, like this one https://requestcatcher.com/. That way you can get the namespaces of what you need from Salesforce and ensure you’re receiving them in the API
You would need to pass those session variables as Inputs at the top of the Data Flow.
So for example, you would create an “email” input at the top of your “Send Email” Data Flow, and then back in your End Point Actions, you would pass session.Contact_Email__C into the email input.
Is there any documentation that explains when to use “session”, “actor”, or “event” when working with variables? They all seem very similar.
If you’re looking for a crash course in variable scopes, you can find that here!
The TL;DR is that they are similar conceptually: “session”, “actor”, and “event” all reference different variable scopes, which define where the variable is accessible. The “session” namespace is used for global variables, which are accessible all throughout a Journey. The “actor” namespace is used specifically for Actor properties, which needed to be defined in a specific way so that they can properly configure outgoing and incoming messages. (Variables in the Actor namespace are also global, but distinct from session variables in how they are used to initialize the Actor. Actors discusses that concept more in depth, if you want to take a look!). Variables in the “event” namespace, meanwhile, can only be accessed during the Event that they’re a part of. It is often important to access this namespace when referencing information that is generated as part of an Event.
hi @Chris_Phillips, yeah this looks like something with the data that you’re passing into the data flows. What does your Mapping step look like? If the Journey event payload is payload.result, then for the variables you would do something like event.sobject.Account_c.
Also for the variables, i’d recommend using the namespaces to be more precise. so instead of the variable name, it would be session.name etc…
I cover how to pass data from a sf subscription in this video. Let me know if its helpful!