SOLVED

Using Location Data in Email Scripting

Go to solution
Highlighted
Level 3

Using Location Data in Email Scripting

We have a JSON source of data with information on 150 locations. Based on a field ID in a person we would like to load the data for 1 of those locations into an email (Address etc).

We see two possible options but are seeing issues both routes:

  1. Import the data as a custom object with API into Marketo. Each location is a separate entry. The problem is how in my email do I load a specific entry based on a field ID in a Person?
  2. Import all the data as a token into Marketo. The problem I am stuck on here is how can I pull just the location I need (Do I have JSON Path or would it have to be nested array structure). and if the JSON structure were to change I would have to update every single email template (Instead of 1 piece of code for import).
Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 10 - Community Moderator

Re: Using Location Data in Email Scripting

You can't do this with a Custom Object -- there's no such thing as a shared CO (2nd-level CO) that's accessible from Velocity.  So [1] is just not an option. (Which is fine, [2] is a good approach.)

(Do I have JSON Path or would it have to be nested array structure). and if the JSON structure were to change I would have to update every single email template (Instead of 1 piece of code for import).

You don't have JSONPath, so you'd be iterating over a List or Map (of course any userland JSONPath implementation is actually doing the same thing).

I don't see why that would even be necessary, if the keys of a Map are your field IDs you can just seek right to them.

You also don't need to update any templates if your matching criteria change, just change the Velocity token that does the seeking.  One change in one place.

View solution in original post

9 REPLIES 9
Highlighted
Level 10 - Community Moderator

Re: Using Location Data in Email Scripting

You can't do this with a Custom Object -- there's no such thing as a shared CO (2nd-level CO) that's accessible from Velocity.  So [1] is just not an option. (Which is fine, [2] is a good approach.)

(Do I have JSON Path or would it have to be nested array structure). and if the JSON structure were to change I would have to update every single email template (Instead of 1 piece of code for import).

You don't have JSONPath, so you'd be iterating over a List or Map (of course any userland JSONPath implementation is actually doing the same thing).

I don't see why that would even be necessary, if the keys of a Map are your field IDs you can just seek right to them.

You also don't need to update any templates if your matching criteria change, just change the Velocity token that does the seeking.  One change in one place.

View solution in original post

Highlighted
Anonymous
Not applicable

Re: Using Location Data in Email Scripting

I am trying to import the data with the API, It looks like i can't import a Script token with the API, Can I import a text token with API and then use that in my email script as the "data source"?

Highlighted
Level 10 - Community Moderator

Re: Using Location Data in Email Scripting

You certainly can modify a script token via API. I do it all the time. What endpoint were you trying and what payload?

Highlighted
Anonymous
Not applicable

Re: Using Location Data in Email Scripting

oh that would be amazing if we can do that. I was referencing the documentation here: http://developers.marketo.com/rest-api/assets/tokens/  and I don't see script token mentioned. Do you know of any documentation on modifying script tokens?

Highlighted
Level 10 - Community Moderator

Re: Using Location Data in Email Scripting

Set

  type=script block

It otherwise is the same as other types.

Highlighted
Level 3

Re: Using Location Data in Email Scripting

Thanks Sanford, you have been very helpful!

Highlighted

Re: Using Location Data in Email Scripting

Hi,

as you have mentioned to use "type=script block" to update  Script-tokens via API - this seems not working anymore since the last 4 weeks - and a Marketo technical guy confirmed they have blocked this type to use on a post, 
as its was never documented as an option to use - but it was working well for many month.

Now we have a problem, do you see any other option  now on how to update a Script-token via API?

We tried to update/write the html in a "rich-text" token {my.content_25112} - and just add this token in a script token - like below,

but the content doesn´t get displayed in an email.

 

script-token:
#### CONTAINER 1 #####
#set ($slotid_25112 =
${my.content_25112}

 

Any recommendation from your experiance?

thanks

Hans-Martin

Highlighted
Level 2

Re: Using Location Data in Email Scripting

Hello,

I can confirm 'script block' is not updating anymore through the API. Is there any other work around you have found so far?

Highlighted
Anonymous
Not applicable

Re: Using Location Data in Email Scripting

It looks like a text token can't be done that way either. Is there any way to import this data with the API to a location that can be used by an email script? Data changes almost daily so I really don't want to copy/ paste...