You need to sign in to do that
Don't have an account?
Arnold Brown
if statement fails with boolean error for picklist field on Account Team Member Object
I'm just trying to write a simple if statement to check the piclist value for TeammemberRole on Account Team object. I've tried it with double equalls signs "==" and using string method .equals(). No matter what I try I continue to get the error. "Condition expression must be of type boolean. It should be a simple thing but it's stopping me cold.
Here's how it looks currently:
Here's how it looks currently:
for(AccountTeamMember member: ATM ){ if (member.TeamMemberRole == 'CRD - Back-up' ){ BackupCRDMap.put(member.Account.id, member.user.name); }
this should fix the error. Hope this helps.
All Answers
The correct syntax is using == in if statement. Can you please share the exact error message and larger code snippet.
Error is "Condition expression must be of type boolean"
What I'm trying to do is write a scheduled class to iterate through our Account Team member records each night and populate custom fields I've set up on the account record itself to show the values. This is because reporting on Oppotunities for instance and including Account Team membership is difficult. So since I can't trigger the update to the Account Custom fields from the Account Team Member object I'm trying a solution with schedulable batch apex. Here's the (unfinished ) code I have so far:
this should fix the error. Hope this helps.