Set Custom Object with Opportunity Item

SanfordWhiteman
Level 10 - Community Moderator

Re: Set Custom Object with Opportunity Item

More like

#set( $lead.CustomObjectEmail = "CATCHALL@EXAMPLE.COM" )
#foreach( $Opportunity in $OpportunityList )
#if( !$display.alt($Opportunity.VARIABLETOUPDATEAGAINST,"").isEmpty() )
  #set( $lead.CustomObjectEmail = $Opportunity.SalesRepEmail__c )
  #break
#end
#end

because you need to account for the field being either null or an empty string.

michaelstancil
Level 3

Re: Set Custom Object with Opportunity Item

Gotcha - Thanks!

michaelstancil
Level 3

Re: Set Custom Object with Opportunity Item

@Jo_Pitts1 so I've been trying to rework this based on limitation, and I've done more digging and found some various close-but-not-quite solutions from @SanfordWhiteman 

 

Regarding flowboost, if I can't set the value of a custom object via velocity, and given that these values are within the opportunity, how would I pass those to a webhook? Webhooks can't receive opportunity info, can they?

 

Perhaps this requires a new post, but is it possible to send a notification email within an email script token? Since the crux of this is the access level of opportunity vs. lead information, could I create an email script token that runs at the end of said consumer facing email that sends a notification containing that opportunity info to the relevant sales person, since all of those items are within the opportunity?

 

Assuming that was the case, my next thought would be to summarize the list of affected items by sales rep, and then sending them a notification email that has all of the affected items for the day. The only thing I'm struggling with (that I'm aware of) is that the DATEFIELDOBJECT__c within the opportunity is a YYYY-MM-DD HH:MM:SS, and I'd like to ignore the HH:MM:SS and just say "if date = today, count the items"

## Time Items
#set( $defaultTimeZone = $date.getTimeZone().getTimeZone("America/Phoenix") )
#set( $defaultLocale = $date.getLocale() )
#set( $calNow = $date.getCalendar() )
#set( $ret = $calNow.setTimeZone($defaultTimeZone) )
#set( $calConst = $field.in($calNow) )
#set( $ISO8601DateOnly = "yyyy-MM-dd" )
#set( $ISO8601DateTime = "yyyy-MM-dd'T'HH:mm:ss" )
#set( $ISO8601DateTimeWithSpace = "yyyy-MM-dd HH:mm:ss" )
#set( $ISO8601DateTimeWithMillisUTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" )
#set( $ISO8601DateTimeWithMillisTZ = "yyyy-MM-dd'T'HH:mm:ss.SSSZ" )

## Filter Items
#set( $CustomList1 = [] )
#foreach( $Opp in $OpportunityList )
#if( $OpportunityList.DATEFIELDOBJECT__c.NOTSURE)
#set( $void = $CustomList1.add($Opp) )
#end
#end

## Display List of Items
#foreach( $Opp in $CustomList1 )
Name: ${OpportunityList.Name}
Phone: ${OpportunityList.Phone}
</br>
#end