• Vivek Sandurekar
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies

Hello!

 

I have some code listed below that I was hoping someone would be able to help me troubleshoot.  The code is supposed to assign the owner of a Lead based on what Account Team of the User.  So when the lead is created, if select "Storefront" for Lead_Direction__c picklist, then it should assign to the Account Team Member on the Account labeled as 'Storefront Associate'.  If the I select Big Deal in the picklist, then it should assign to the Account Team Member for the associated Account labeled as the 'Big Deal Associate'.  It works when I select Storefront in the Lead Direction and assigned the appropriate rep, but it doesn't assign correctly to the Big Deal Rep.

 

trigger OpportunityTrigger on Lead (before insert){

    List<String> accountIds = new List<String>();
    
    List<AccountTeamMember> parentAccounts = new List<AccountTeamMember>();
    
    for(Lead lead : Trigger.new){
    
        accountIds.add(lead.Account__c);    
    }
    
    parentAccounts = [Select AccountId, UserId, TeamMemberRole from AccountTeamMember where AccountId in :accountIds];
    
    Map<String,AccountTeamMember> accountMap = new Map<String,AccountTeamMember>();
    
    for(AccountTeamMember a : parentAccounts){
    
        accountMap.put(a.AccountId,a);
    }
    
    for(Lead lead : Trigger.new){
    
        AccountTeamMember parentAccount = accountMap.get(lead.Account__c);
        String memberRole = accountMap.get(lead.Account__c).TeamMemberRole;
        
        if((parentAccount != null)&&(memberRole == 'Storefront Associate')&&(lead.Lead_Direction__c == 'Storefront')){
        
            lead.OwnerId = parentAccount.UserId;
            
        }
        
        else if((parentAccount != null)&&(memberRole == 'Big Deal Associate')&&(lead.Lead_Direction__c == 'Big Deal')){
        
            lead.OwnerId = parentAccount.UserId;
          
        }
        
        else{
        
        lead.OwnerId = lead.OwnerId;
        
        }
        
    }
}

 

I'm setting up the process-conf.xml file to set up a series of Upsert processes and can't find a Configuraton Parameter for Related Objects...

 

'sfdc.externalIdField' allows me to specify the External ID field used for data matching which in the GUI corresponds to

 

Step 2a: Choose your field to use for matching --> sfdc.externalIdField

 

Step 2b: Choose your related objects --> ???

 

 

I can't find any mention of this in any of the Data Loader documentation...

 

Any help is greatly appreciated!

 

Mike