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
paul.magpaul.mag 

Find users with specific roles in the Account Team

We are extending the lead object to capture expressions of interest from our website. This means that some new records will be existing contacts and we want to inform either the account manager or client services rep of the expression of interest. I'm messing around with a trigger to do this but as i'm just getting into apex any help would be appreciated.
The flow is:
Lead created
Lead is a contact
Go to the account team and search for Account manager & client services
Update field on lead record with the user name for those roles

Thanks
Atul111Atul111
Hi Paul,

i will help you regarding this issue. I need more information of this issue.

Regards | Atul
paul.magpaul.mag
Thanks, what information do you need?
Atul111Atul111
Do you want to check with contact name, email id and acount name or any one of them?
Which objects fields do you want to modify?

paul.magpaul.mag
The lead record has a look up field to Contact (Contact__c) and to Account (Account__c) so we should search for  Lead.Account__c == Account.ID. On the Lead record there is also an account_manager__c and a client_servcies__c field.
Is that ok?