4

I am trying to use an exclusion script in an email send activity to inject data to a data extension. I have no intention of sending the email.

I have tried with both upsertDE() (the email send version of the function) and upsertData() (the script activity and landing page version of the function).

It works 100% of the time when running the script in an email send, script activity or landing page, but does not seem to work as an exclusion script within journey builder.

Exclusion script: TreatAsContent(ContentBlockByKey("test_script"))==1

Content Block with Key 'test_script':

%%[ 
Var @subkey, @content, @name, @result
Set @subkey = _subscriberkey
Set @name = "John"
Set @content = "Hello World"
Set @result = 1
UpsertDE(
"test_script_de"
,1
,"subscriberkey",@subkey 
,"name", @name
,"content",@content
) 
]%% 
%%=v(@result)=%%
7
  • 3
    That’s not really what exclusion scripts are used for. They shouldn’t ever be used to write data, if even possible. What are you trying to accomplish? Upserting rows to a DE? Why not use the Update Contact activity in JB?
    – Tyler
    Oct 4, 2019 at 16:49
  • I realise it's not what they are intended for, but we would find it very useful to be able to trigger scripts with journey builder, without having to send an email. In this use case update contact activity won't work as we want to render dynamic content and enter it into a separate data extension.
    – pshp
    Oct 4, 2019 at 19:56
  • 1
    If JB is a must. I would use JB to add the rows to a DE (update contact activity), and an automation studio script activity to process the rows in that DE. By using the product in unintended ways, you are setting yourself up for unintended consequences.
    – Tyler
    Oct 5, 2019 at 4:09
  • You can also create a custom JB activity (developer.salesforce.com/docs/…). It isn't easy to do, but gives you many options and features that are not native to JB. Oct 7, 2019 at 12:51
  • The reason we state that it is not what those are used for is because any 'hack' in SFMC is an 'at your own risk' process. Meaning the risk of failure is increased and there is no support available by SFMC on your process. This is far from an optimum approach for any significant or important campaign in SFMC. Oct 7, 2019 at 12:53

1 Answer 1

1

You can do this with a little less creativity - the "hacky" approach does have its downsides as stated.

Another suggestion:

You can use an Update Contact Event to write into a separate Data Extension.

Your separate DE needs to have the following configuration:

  • Sendable
  • A field with the exact name of "SubscriberKey"
  • Subscriber Relationship on SubscriberKey = Subscriber Key
  • other fields to your liking

Configure the activity in such a fashion that all the "other" fields are populated, but simply ignore the SubscriberKey field in the activity. It will auto-populate in this setup. This will help you track your dynamic journey setup in many cases.

Hope this helps!

2
  • Update contact activity will actually upsert.
    – Tyler
    Oct 7, 2019 at 17:00
  • ah sorry, confused it. in that case, there is nothing that wouldn't work. I'll edit the answer. Oct 7, 2019 at 20:35

You must log in to answer this question.

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