We want to get the emails from the opportunity team and then populate them on custom object (I.e. Populating them in separate custom field fr each email id).

We have created a custom button on custom object (Child object of opportunity) by using vf page.

<apex:page standardController="Contracts__c">
<flow:interview name="Pre_Notification" finishLocation="/{!Contracts__c.Id}">
    <apex:param name="ContractsId" value="{!Contract_s__c.Id}"/>

by passing the contracts id to flow, and based on some criteria we are sending alerts.

In addition to this we want to send the notifications to opportunity team as well. So we are planning to get the email ids of the opportunity team and populate them in custom email fields in contracts and these email fields can be used in email alerts.

Please let me know your thoughts on this...


Create a custom field at Contract object "Opportunity Team Mail Address (API name: OpportTeam_Mail_Address__c )".

Then with the help of below trigger on update of any contract, we will be able to tag the email address of the Account Team Member. Please find the Trigger below:

trigger TagOppTeamMemEmailAddress on Contract (Before Update) {
    Map<Id,Id> mapOfAccIdVsContrtId = new Map<Id,Id>();
    Set<Id> uniqAccIDSet = new Set<Id>();
    Set<Id> oppIdSet = new Set<Id>();
    Map<Id,Id> mapOfOppIdVsAccId = new Map<Id,Id>();
    Map<Id,String> mapOfOppIdvsEmailAdd = new Map<Id,String>();
    Map<Id,String> mapContactvsEmailToUdt = new Map<Id,String>(); 
    Set<ID> contrSet =  new Set<ID>();

if(Trigger.isBefore && Trigger.isUpdate){
    for(Contract cntr:Trigger.New){
        System.debug('@@@ cntr:'+cntr);
        if(cntr.AccountId != null){
    System.debug('@@@ mapOfAccIdVsContrtId:'+mapOfAccIdVsContrtId);
        for(Opportunity opp:[SELECT Id,AccountId FROM Opportunity WHERE AccountId In:uniqAccIDSet]){
            mapOfOppIdVsAccId .put(opp.Id,opp.AccountId);
        if(oppIdSet.size() > 0){
            for(Opportunity_Team__c oppTeamMem :[SELECT Id,Email__c,Opportunity__c FROM Opportunity_Team__c WHERE Opportunity__c In:oppIdSet]){
                if(oppTeamMem.Email__c != null && oppTeamMem.Email__c != ''){
        System.debug('@@@ mapOfOppIdvsEmailAdd:'+mapOfOppIdvsEmailAdd);

            for(Id oppId : mapOfOppIdvsEmailAdd.Keyset()){
                if(mapOfAccIdVsContrtId.get(mapOfOppIdVsAccId.get(oppId)) != null){

        //Section where we are updating the email from Opp Team Mem
            for(Contract cntr:Trigger.New){
                cntr.OpportTeam_Mail_Address__c = mapContactvsEmailToUdt.get(cntr.Id);



  • sorry to say we are trying with configuration only so...Please suggest with only configuration..i.e with flow or process etc. – Reddy Apr 18 '17 at 9:08

Unfortunately, Visual Workflow can't perform a lookup on Account Team or Opportunity Team members. And Process Builder can't perform lookups.

I don't think there is a configuration-only solution to your requirements with Visual Workflow or Process Builder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.