You need to sign in to do that
Don't have an account?
Initial term of field expression must be a concrete SObject
Hello,
I was wondering if someone would be able to help me fix my code. The premise of what I am trying to do is whenever a lead is created, if Storefront is selected in the Lead_Direction__c picklist, assign it to the listed Storefront Associate in the Account Team for the particular Account. If Big Deal is selected in the Lead_Direction__c picklist, assign it to the Big Deal Associate listed for the particular Account's Account Team.
I am pretty sure this probably isn't the prettiest and concise way to go about doing this either, so if there's an entirely easier way to get the end result, I am completely open to changing my code.
This the error I am getting and highlighted the line below:
Initial term of field expression must be a concrete SObject: LIST<AccountTeamMember> at line 13 column 61
trigger LeadAssignmentTrigger on Lead (before insert){ for (Lead lead : Trigger.new){ if (lead.Account__c != NULL){ // Find the Account Team Member for the Particular Lead List<AccountTeamMember> account = [SELECT AccountId,UserId,TeamMemberRole FROM AccountTeamMember where Accountid = :lead.Account__c limit 2]; // if you found one if (account.size() > 0) { if((lead.Lead_Direction__c == 'Storefront')&&(account.TeamMemberRole == 'Storefront Associate')){ //assign the lead owner to the Storefront Owner lead.OwnerId = account[0].UserId; } else if ((lead.Lead_Direction__c == 'Big Deal')&&(account.TeamMemberRole == 'Big Deal Associate')){ //assign the lead owner to the Big Deal Owner lead.OwnerId = account[0].UserId; } } } } }
All Answers
Thank you! :)