SOLVED

Lead/Person with multiple Opportunities

Go to solution
Anonymous
Not applicable

Hello,

Can someone confirm this?

In our business, a Contact can have multiple Opportunities and we use Opportunity records extensively. However we found an issues for leads that have multiple Opps when sending email that has tokens.

Example: a lead has 2 opportunities. Opportunity: A & B, Opp B is qualify for a smart campaign, and flow step is to send out an email (email has token in it). When the email is sent out, it use Opp A as the reference, thus the token in the email is populating from Opp A data, not Opp B.

If this is the case, is there any workaround? Again we use Opp record extensively and email script token in our email is crucial.

I know my explanation is not perfect, but do let me know if you need more clarification.

1 ACCEPTED SOLUTION
Grégoire_Miche2
Level 10

Hi Billy,

Indeed, the way you script is developed is the problem (sorry for being blunt).

This line of code indeed retrieves the 1st opportunity. It should retreive them all, then browse them to filter and pick the appropriate one. It's a more sophisticated dev you need here to do what you want.

-Greg

View solution in original post

13 REPLIES 13
Grégoire_Miche2
Level 10

Hi Billy,

The only way is to set up your script token with additional logic so that is can filter the right opportunity. The script can retrieve as much as 10 opportunities, which should hopefully be enough.

One of the trick is so set a value in a lead field, before sending the email. Then, in the script, you can use that field value as a filter to select the opportunity.

Also, vote here: , as if we could use programs tokens in scripts, it would make life easier.

-Greg

Anonymous
Not applicable

it is filtering the right opportunity, that isn't the problem. Problem is when sending an email, it looks like Marketo will always look at the 1st Opp record attached to the Contact/Lead for reference.

Grégoire_Miche2
Level 10

I do not understand what you are referring to here. Is you are talking about the velocity script token, it depends on how it is developed.

-Greg

Anonymous
Not applicable

123.PNG

Does this answer your question? This sript token is included in several of our email. Again if a person has more than 1 Opp records, and when sending an email Marketo is using the first Opp attached as a reference, even though the second Opp is the one that qualify for the smart campaign.

Grégoire_Miche2
Level 10

Hi Billy,

Indeed, the way you script is developed is the problem (sorry for being blunt).

This line of code indeed retrieves the 1st opportunity. It should retreive them all, then browse them to filter and pick the appropriate one. It's a more sophisticated dev you need here to do what you want.

-Greg

Anonymous
Not applicable

Thanks Greg! I will reach out to our tech support consultant for assistance!

SanfordWhiteman
Level 10 - Community Moderator

You should be referencing $TriggerObject. No need to iterate.

Grégoire_Miche2
Level 10

Hi Sanford,

Only is the email is sent through a trigger

The use case described by Billy does not state whether or not this is the case.

-Greg

Anonymous
Not applicable

it used in both trigger and batch campaigns. I will look into email script in trigger vs batch.

We just recently migrated to Marketo, thus i am not familiar with the limitation of Marketo just yet. Thanks for the input.

SanfordWhiteman
Level 10 - Community Moderator

In a batch campaign, you can't be sure that the Opportunity that matches the filter will even be available on the object (if it is too old).  So you need to take that possible error into account.

Anonymous
Not applicable

Thanks for the heads up, the $TriggerObject work like a charm for the trigger campaign. As for batch campaign is there any documentation you can point me towards? Based on my understanding, I will need to include somekind of logic/filter into the token to properly pulling information from the right Opp. If you can provide some kind of guideline, that will be great!

SanfordWhiteman
Level 10 - Community Moderator

You'll have to filter the OpportunityList ArrayList within Velocity code. The problem is that you only get to see the last 10 oppos in Velocity.  I referred to other oppos as "too old" but I was referring to the 10-oppo limit.

Anonymous
Not applicable

Thank you Sanford, I am not much of a coder and could not find any docs regarding to OpportunityList ArrayList within Velocity code. Any idea where I can find some guideline? The concern about the 10 opps is not much of a concern in our business since it is very rare for a contact to have more than 5 opps anyway.