You need to sign in to do that
Don't have an account?
AL
Matching Account and Lead Name - Sharing Rule
Hello, our Organization-wide default settings for accounts and leads is private. I would like to create a solution where if the Account Name matches the Lead Company name, then the Account Owner can edit that lead record. I've tried using code that I found on this forum to update a custom checkbox field if the Account Name and Lead Company match. The issue I'm running into is when I create the Lead sharing rule in settings, I can't specify record access by user, but rather only by group. Is there a way to specify it by Account owner? Thank you
trigger LeadMatch on Lead (before insert,before update) {
List<Account> accList = [Select Id,Name from Account];
for(Lead lead : trigger.new){
lead.LeadAccountMatch__c = false;
for(Account acc: accList){
if(lead.Company == acc.Name && lead.OwnerId != acc.OwnerId){
lead.LeadAccountMatch__c = true;
break;
}
}
}
}
trigger LeadMatch on Lead (before insert,before update) {
List<Account> accList = [Select Id,Name from Account];
for(Lead lead : trigger.new){
lead.LeadAccountMatch__c = false;
for(Account acc: accList){
if(lead.Company == acc.Name && lead.OwnerId != acc.OwnerId){
lead.LeadAccountMatch__c = true;
break;
}
}
}
}
Since lead is a stand alone object not related to anything (until its converted) there is no way you can allow account owner to edit lead if company name on lead = account name.
However, I came across this blog https://automationchampion.com/tag/flow-based-record-sharing-in-salesforce/, may be you can just check if you can tweak it a little bit to suit your requirement.
Cheers,
Aparna Hegde
All Answers
Since lead is a stand alone object not related to anything (until its converted) there is no way you can allow account owner to edit lead if company name on lead = account name.
However, I came across this blog https://automationchampion.com/tag/flow-based-record-sharing-in-salesforce/, may be you can just check if you can tweak it a little bit to suit your requirement.
Cheers,
Aparna Hegde