You need to sign in to do that
Don't have an account?
Jemill
Write Account Team Member to Custom Object lookup field
Hi,
I'm trying to create a trigger on my Custom Object named Survey that places an Account Team Member of role = CJ Advertiser Account Director into my lookup field Current AD Test. I am new to coding and am aware my code might be extremely wrong. Any help appreciated!
I'm trying to create a trigger on my Custom Object named Survey that places an Account Team Member of role = CJ Advertiser Account Director into my lookup field Current AD Test. I am new to coding and am aware my code might be extremely wrong. Any help appreciated!
trigger AccountDirector on Survey__c (before update, after insert) { for (Survey_c SUR : Trigger.net){ try{ ID samID = [select UserId from AccountTeamMember where AccountId = : SUR.Account_link_id and TeamMemberRole = 'CJ Advertiser Account Director'].UserId; SUR.Current_AD_Test_c = samID; } } }
NOTE: This code has not been tested and may contain typographical or logical errors.
All Answers
NOTE: This code has not been tested and may contain typographical or logical errors.
"Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger AccountDirector caused an unexpected exception, contact your administrator: AccountDirector: execution of BeforeInsert caused by: System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: AccountTeamMember.AccountId: Trigger.AccountDirector: line 18, column 1"