You need to sign in to do that
Don't have an account?

How to Query AccountTeamMember table to get UserId with specific Role?
In a trigger, I want to assign a field to the UserID of the user who has 'Account Primary' role.
On the line beginning, "Account acct ...", I'm getting a Problem message of:
Save error: expecting a semi-colon, found 'acct'
There are no missing ' ; ' end of line characters prior to the line.
Once that is working, then the line beginning, "trigger[i].APP..." may cause me problems. I'm not sure if the '__r' designation is required - or, that I've got the naming of the acct.AccountTeamMember.UserId variable correct.
Thanks,
Code:
for (integer i=0; i<trigger.size; i++) { Account acct = Select (Select Id, TeamMemberRole, UserId From AccountTeamMember Where TeamMemberRole = 'Account Primary') From Account
Where id = :trigger[i].SERVICING_ACCOUNT__c);
trigger[i].APPROVING_USER__c = acct.AccountTeamMember.UserId; }
On the line beginning, "Account acct ...", I'm getting a Problem message of:
Save error: expecting a semi-colon, found 'acct'
There are no missing ' ; ' end of line characters prior to the line.
Once that is working, then the line beginning, "trigger[i].APP..." may cause me problems. I'm not sure if the '__r' designation is required - or, that I've got the naming of the acct.AccountTeamMember.UserId variable correct.
Thanks,
Thanks to the patient support person who helped.
All Answers
I'm getting:
Save error: unexpected token: tgtId
on the line beginning tgtId = ... - right under the 'for' line
and SERVICING_ACCOUNT__c is a lookup field into Account.
(I'm hoping there's a careless mistake I'm too close to see...)
The error message I'm getting when I try to assign 'm', (2nd code line from last code line), is:
"Save error: unexpected token: ["
Thanks
Thanks to the patient support person who helped.