function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Carolina W 2Carolina W 2 

How can I put another Object in the Opportunity validation rule?

I'm trying to allow only the Account's Owner and Account Team Members "001" to create opportunities. But I'm getting "The AccountTeamMember field does not exist".
How can I solve it?
 
OR($User.Id <> Account.Owner.Id, 
VLOOKUP(AccountTeamMember.TeamMemberRole, AccountTeamMember.UserId,$User.Id)<> "001")
Best Answer chosen by Carolina W 2
VinayVinay (Salesforce Developers) 
Hi Carolina,

I don't think you can use validation rule based on user's team membership.

Kindly review below Idea link and vote for this feature.

https://trailblazer.salesforce.com/ideaView?id=08730000000BptWAAS

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,

All Answers

VinayVinay (Salesforce Developers) 
Hi Carolina,

I don't think you can use validation rule based on user's team membership.

Kindly review below Idea link and vote for this feature.

https://trailblazer.salesforce.com/ideaView?id=08730000000BptWAAS

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
This was selected as the best answer
Carolina W 2Carolina W 2
I had to create an Apex Class