Velocity token to identify Campaign Run Id during email build

Thomas_Terry1
Level 2

Just a crazy question, likely only answerable by Sanford Whiteman

Is it possible to use velocity script to identify the Campaign Run Id during the email build process?

Or is this totally impossible?

FYI - I'm not referring to building an email via the UI editor. Instead, it is the automated process that occurs after the campaign is initiated.

12 REPLIES 12
SanfordWhiteman
Level 10 - Community Moderator

To be precise, do you want to include the Campaign Run ID somewhere else in the email, like on a link?

Thomas_Terry1
Level 2

Yes, exactly. We want to use a concatenation of Asset Id, Campaign Id and Run Id to uniquely identify a send. We would append the Campaign Run Id as a URL parameter.

SanfordWhiteman
Level 10 - Community Moderator

Thomas, sent the solution via email (since I have your address) for now -- will add officially to the blog and link there tomorrow.

Vimal_Ghosh
Level 1

Can you please provide the solution. I have a similar scenario

Mark_Price
Level 7

Beware of API triggered messages that may send the same templateId. There is a pretty terrible bug system behavior where the lowest campaignRunId will be re-used

Vimal_Ghosh
Level 1

Does that mean, if a campaign runs multiple times for a lead. I am not in a position to get a unique Run Id for each run?Sorry , I am new to Marketo.

Mark_Price
Level 7

That is correct- if the Trigger is from the API or from a field change that occurred in the API you will not get a unique campaignRunId for the subsequent runs.

You will get a unique campaignRunId if it is not an API based trigger.

It's a strange system behavior that makes the campaignRunId unusable in some instances.

SanfordWhiteman
Level 10 - Community Moderator
Vimal_Ghosh
Level 1

Thanks. Is there a way to get the CampaignRunId as part of the Webhook. I wanted to send that id to an external system when the email is triggered. Also, is there a way to get a custom attribute included within an email when the open event is triggered

SanfordWhiteman
Level 10 - Community Moderator

You can't use Velocity in webhooks (well, not unless you do some very crazy things that aren't suitable for a Community post).

You can't change the default open logging but you could include your own custom open-tracking pixel if you insisted on it.

I have to wonder why such a setup is necessary. What are you trying to do, really? Note Mark's comment about the Campaign Run ID.

Vimal_Ghosh
Level 1

We have campaigns created within Marketo which uses different email templates. Emails contains placeholders, which will be replaced by actual values from a lead record using tokens. The trigger here is a change in the values for specific fields in lead record. The values are changed by an external system using Marketo APIs. So this campaign can be executed multiple times and leads can receive emails multiple times. We have a unique identifier from the external system which trigger these changes. I can include this in our Lead record as well. However, wanted to get that data once the user opens the mail. Essentially trying to understand whether the trigger initiated by the external system is effective or not and there are back office operations after that. So, I am hoping to tie the campaign , a particular run, the lead and the unique identifier which triggered the decision. Any inputs here is highly appreciated

Thomas_Terry1
Level 2

Hi Sandy, you are awesome. I look forward to seeing your blog post on the topic.