Hi all,
I'm trying to set a custom object to an email that is within an opportunity item so that I can use that newly set custom object to send a notification email via the flow step. This is because we send an email to a client with opportunity-specific info, and then we want to alert the sales rep of that email, but for other reasons, not all sales reps are on the lead level, so I need to surface them.
I've created a token that I've placed within the email that goes out to the client, and the referenced items are checked on the right, however, the values don't update.
#set( ${OpportunityList.get(0).SalesRepEmail__c} = ${lead.CustomObjectEmail})
Any thoughts?
Are you expecting this to update back into the database?
If so, that won't work. Velocity doesn't write back to the Marketo DB.
Regards
That's exactly what I was hoping...as I was going to use that new field and perform a change data value. Are there any other ways around something like this?
I'm a bit bewildered here.
Are you trying to update the Sales Rep email on the lead or on the opportunity?
What if they have more than one opportunity.
i.e. can you explain the use case wrt opportunities and leads please
Welcome to my world haha.
So we have Account and Sales owners, but because of how our system works they may get moved off to a variety of reasons and replaced with a catchall. Should that opportunity update to be valid again, the catch-all will remain on the account/sales level, but the in-opportunity fields will update with that correct info.
It is very likely the sales reps will have multiple opportunities, so they would get multiple emails, one per unique opportunity (tied to a customer email, one opp per cust email)
The opportunity Owner (which does surface in the notification option) is there, but it's only their name. Is there some way to transform that field to an email?
@michaelstancil I’ll let you and Jo continue with the business requirements discussion, but be aware there are problems with this code on its own:
#set( ${OpportunityList.get(0).SalesRepEmail__c} = ${lead.CustomObjectEmail})
@SanfordWhiteman Thanks for the pointers, you made me realize I needed another value to key off of.
#set( $lead.CustomObjectEmail = "CATCHALL@EMAIL.COM" )
#foreach( $Opportunity in $OpportunityList )
#if( $Opportunity.VARIABLETOUPDATEAGAINST.isNotEmpty )
#set( $lead.CustomObjectEmail = $Opportunity.SalesRepEmail__c )
#break
#end
#end
this still won't work no matter HOW technically correct your code.. you can't update the lead from Velocity (hence why I didn't even get into to discussing coding with you).
I think you need a webhook to do this. FlowBoost is probably a good option.
@SanfordWhiteman, can you see custom objects in FlowBoost?
Cheers
Jo
@Jo_Pitts1 gotcha, let me take a look!
@SanfordWhiteman (and Jo) if it WAS possible, would the revised code be correct at least?