0

I have a set of steps that I want to process in Salesforce Marketing Cloud, but I'd like to make it easier for my users. I have a set of steps I want to run if a column is "True" and a different set of steps that I want to run if a condition is "False". There are multiple SQL queries/steps and they are all setup, but I wanted to create a single "easy button" that would allow for users to change the "True" or "False" value in my data table on a single record and have it run the other processes.

Here is an example:

Master Table: Row 1: True or False

Other tables IF TRUE: Select SubscriberKey, Email, Value= 'Yes' From Contact_Salesforce

IF FALSE: Select SubscriberKey, Email, Value= 'No' FROM Contact_Salesforce

It is actually more complex than this, but I wanted to make it simpler. Basically, I'd love to run certain SQL queries in an automation if that master table is true and not if it is false (do nothing) and vice versa for the other steps.

Is there a way to do this, or should I just have them do the "run once" on the first set of steps if the condition is true and run the other set of steps as a "run once" if it is false?

1 Answer 1

2

Here's a pattern that I use for referencing a "parameter" data extension.

You can reference the results of the join in a case statement or in the where-clause, depending on the specifics of your use case.

(The outer apply behaves like a left join except the criteria is on the inside.)

Contact_Salesforce

Id Email someField
111 [email protected] null
222 [email protected] null

Master_Params

LookupKey toggle1 toggle2
1 False True

Query

select
  c.id as subscriberKey
, c.email
, case 
   when params.toggle1 = 1 then 'whee'
   else 'nope'
  end as toggle1
, case 
   when params.toggle2 = 1 then 'whee'
   else 'nope'
  end as toggle2
from Contact_Salesforce as c
outer apply (
  select
    p.toggle1
  , p.toggle2
  from Master_Params as p
  where p.lookupKey = 1
) params

Query results

subscriberKey email toggle1 toggle2
111 [email protected] nope whee
222 [email protected] nope whee

Try it yourself: https://dbfiddle.uk/6TnrPkIh

1
  • Thank you- that should work for my use case! I'll try it out in Salesforce Marketing Cloud and see if I can get it running, but it definitely does the appropriate actions I wanted. Thanks so much! Nov 22, 2023 at 20:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .