SOLVED

Retrieve UPDATED field value from the trigger object in flow steps

Go to solution
ABabb_1
Level 1

Retrieve UPDATED field value from the trigger object in flow steps

We are looking to launch a saved cart campaign and I thought I'd post here as I see some posts that are similar to our issue but don't seem to have a definitive answer or solve.

 

Saved Cart Email Flow is as follows:
1. Someone saves a cart and gets email 1
2. Gets email 2 After a wait period (wait will be 7 days once live)
3. Gets email 3 after a wait period (wait will be 7 days once live)

 

* People can run through the flow each time they are added to cart. The email links all reference the trigger cart only. With velocity scripting, I've got this working correctly for all 3 emails, even in cases where there are multiple carts at the same time.

 

**If someone completes the cart, they are removed from the flow only for that cart. I'm still working through this and running into some issues below:

 

When the saved cart custom object status is updated to "Complete", the original value of "New" is populating in the email flow using the {{trigger.Status}} token. Status is a field on the Saved Cart Object and is updated to Complete when an order is completed. This makes it impossible to remove people from a single cart flow instead of ALL cart flows (if we use 'remove from flow'). Per Marketo support, pulling in the current cart status value SHOULD be possible but I am not seeing a good solve. 

Has anyone done something similar?

Is it true that we can't pull in CURRENT custom object fields values via a token/trigger token Saved Cart TriggerSaved Cart TriggerEmail FlowEmail Flowin a flow step?

 

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Retrieve UPDATED field value from the trigger object in flow steps


@Darshil_Shah1  The poison pill is an interesting approach and worth a try. I have a few questions:

1. Can I reference TriggerObject.status to get the current "Complete" status in velocity?


Yes, this should work! (supported by a quick round of test a few moments back).

 


2. Can I add the macro(s) to the token script I currently use to populate the URL (below) or would I have to create a new one? I'm not sure where to start.

#set($url = "${TriggerObject.cartID}")
<a href="http://${url}" style="font-size: 16px;font-family: Arial,sans-serif;color: #ffffff;text-decoration: none !important;"><strong>COMPLETE ORDER</strong></a>

Thanks!


You could always split your velocity script into multiple email script tokens and include them in the emails (instead of including everything in a single script token). You just need to make sure to include all tokens in the email for you to be able to make cross-script token references. Alternatively, you could also create macros to call later from the script, but you might want to read Sandy's blog post here on using the velocimacros for link output here before.

 

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Retrieve UPDATED field value from the trigger object in flow steps

Trigger values are always persisted in the flow (it would be pure havoc if they weren’t!).

ABabb_1
Level 1

Re: Retrieve UPDATED field value from the trigger object in flow steps

Thanks, Sanford. Is there any way around it that you can see?

Just need to know if that particular cart is updated when it's time to send the follow-up emails.

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Retrieve UPDATED field value from the trigger object in flow steps

Well, the trigger values are always preserved and not queried in real-time from the database while in the flow, which is why you're seeing this. This wouldn't work even if you create separate requestable campaigns for each email send and look at the Status value in each campaign's SL as IMO you'd not be able to carry the reference of the CO from your parent campaign over to the child campaign. As a last resort, you could always throw a velocity-level error (poison pill) when the status field for that instance of the CO record is "Completed".

 

ABabb_1
Level 1

Re: Retrieve UPDATED field value from the trigger object in flow steps

@Darshil_Shah1  The poison pill is an interesting approach and worth a try. I have a few questions:

1. Can I reference TriggerObject.status to get the current "Complete" status in velocity?

2. Can I add the macro(s) to the token script I currently use to populate the URL (below) or would I have to create a new one? I'm not sure where to start.

#set($url = "${TriggerObject.cartID}")
<a href="http://${url}" style="font-size: 16px;font-family: Arial,sans-serif;color: #ffffff;text-decoration: none !important;"><strong>COMPLETE ORDER</strong></a>

Thanks!

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Retrieve UPDATED field value from the trigger object in flow steps


@Darshil_Shah1  The poison pill is an interesting approach and worth a try. I have a few questions:

1. Can I reference TriggerObject.status to get the current "Complete" status in velocity?


Yes, this should work! (supported by a quick round of test a few moments back).

 


2. Can I add the macro(s) to the token script I currently use to populate the URL (below) or would I have to create a new one? I'm not sure where to start.

#set($url = "${TriggerObject.cartID}")
<a href="http://${url}" style="font-size: 16px;font-family: Arial,sans-serif;color: #ffffff;text-decoration: none !important;"><strong>COMPLETE ORDER</strong></a>

Thanks!


You could always split your velocity script into multiple email script tokens and include them in the emails (instead of including everything in a single script token). You just need to make sure to include all tokens in the email for you to be able to make cross-script token references. Alternatively, you could also create macros to call later from the script, but you might want to read Sandy's blog post here on using the velocimacros for link output here before.

 

ABabb_1
Level 1

Re: Retrieve UPDATED field value from the trigger object in flow steps

Great, thank you! I'll look more into this.