I need to:
- 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!
Hey Chris! Good question.
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
Would I then be able to use the naming from “Variable” under “Set Variable” to call that data in my data flow?
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.
Thank you for those resources!
In this project, would I need to use “result.sobject.Message__C” for my value rather than event.result.Message__C? Image below for reference.
is the more general reference, yes. If you’re working directly in a Data Flow or an App API, you don’t need to reference a namespace within it.
If you’ve bound this object to, say, a Session variable, call it
variable_name, then you would need to refer to it as
Does that make sense?
Still having an issue pulling a variable from this webhook.
Naming the variable and value
Adding the name to the data flow
Variable added to dataflow
Trying to print result in email, no result returned.
I think it is a problem with the variable value?
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
I cover how to pass data from a sf subscription in this video. Let me know if its helpful!
Thanks, it’s working now! I just needed to use event.sobject.** in my data flow end point action.