• Mukesh in Cloud
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 3
    Questions
  • 4
    Replies
I am an Admin with no real Apex experience and need help to determine what exactly is happening in this Apex Trigger. I belive it is a trigger to share an Account record when some custom Shared With fields are populated. Trying to determine if we can do away with this trigger and utilize something simpler like Account Teams. Thanks!
 
public class ShareWithTriggerHandler {
    public static void afterInsert(Account[] accounts){
    List<AccountShare> sharesToadd = new List<AccountShare>();
    List<AccountShare> sharesToadd2 = new List<AccountShare>();
    List<AccountShare> sharesToadd3 = new List<AccountShare>();
    List<AccountShare> sharesToadd4 = new List<AccountShare>();
  AccountToContactSync acs = new AccountToContactSync();
  acs.UpdateSharedWith(accounts);
        for(Account acclist: [SELECT Id,Name,Shared_With2__c,Shared_With3__c,Shared_With4__c,Shared_With__c FROM Account WHERE Id IN : accounts])
            {
                if(acclist.Shared_With2__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With2__c);
                AccountShare accShare2  = new AccountShare();
                accShare2.AccountId = acclist.id;
                accShare2.UserOrGroupId = acclist.Shared_With2__c;
                accShare2.AccountAccessLevel = 'Edit';
                accShare2.OpportunityAccessLevel = 'Read';
                accShare2.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd2.add(accShare2);
                // Database.insert(accShr,false);
                }
                if(acclist.Shared_With3__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With3__c);
                AccountShare accShare3  = new AccountShare();
                accShare3.AccountId = acclist.id;
                accShare3.UserOrGroupId = acclist.Shared_With3__c;
                accShare3.AccountAccessLevel = 'Edit';
                accShare3.OpportunityAccessLevel = 'Read';
                accShare3.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd3.add(accShare3);
                }
                if(acclist.Shared_With4__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With4__c);
                AccountShare accShare4  = new AccountShare();
                accShare4.AccountId = acclist.id;
                accShare4.UserOrGroupId = acclist.Shared_With4__c;
                accShare4.AccountAccessLevel = 'Edit';
                accShare4.OpportunityAccessLevel = 'Read';
                accShare4.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd4.add(accShare4);
                }
                if(acclist.Shared_With__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With__c);
                AccountShare accShare  = new AccountShare();
                accShare.AccountId = acclist.id;
                accShare.UserOrGroupId = acclist.Shared_With__c;
                accShare.AccountAccessLevel = 'Edit';
                accShare.OpportunityAccessLevel = 'Read';
                accShare.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd.add(accShare);
                }
                system.debug('!!!!'+acclist);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd, false);
            }
            if(!sharesToadd2.isEmpty())
            {
            Database.insert(sharesToadd2, false);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd3, false);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd4, false);
            }

        }
    public static void afterUpdate(Account[] accounts,Map<Id,Account> oldMap)
        {
        List<AccountShare> sharesToDelete = new List<AccountShare>();
    System.debug('******BEGIN UpdateSharedWith******');
    AccountToContactSync acs = new AccountToContactSync();
    acs.UpdateSharedWith(accounts);
    System.debug('******END UpdateSharedWith******');
        for(AccountShare acclist1: [SELECT Id FROM AccountShare WHERE AccountId IN :trigger.oldMap.keyset() AND RowCause = 'Manual'])
            {
            sharesToDelete.add(acclist1);
            // List<AccountShare> sharesToDelete = [SELECT Id FROM AccountShare WHERE AccountId IN :trigger.oldMap.keyset() AND RowCause = 'Manual'];
            }
        if(!sharesToDelete.isEmpty())
            {
            Database.Delete(sharesToDelete, false);
            }
        List<AccountShare> sharesToadd = new List<AccountShare>();
        List<AccountShare> sharesToadd2 = new List<AccountShare>();
        List<AccountShare> sharesToadd3 = new List<AccountShare>();
        List<AccountShare> sharesToadd4 = new List<AccountShare>();
        for(Account acclist: [SELECT Id,Name,Shared_With2__c,Shared_With3__c,Shared_With4__c,Shared_With__c FROM Account WHERE Id IN : accounts])
            {
            if(acclist.Shared_With2__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With2__c);
                AccountShare accShare2  = new AccountShare();
                accShare2.AccountId = acclist.id;
                accShare2.UserOrGroupId = acclist.Shared_With2__c;
                accShare2.AccountAccessLevel = 'Edit';
                accShare2.OpportunityAccessLevel = 'Read';
                accShare2.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd2.add(accShare2);
                // Database.insert(accShr,false);
                }
                if(acclist.Shared_With3__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With3__c);
                AccountShare accShare3  = new AccountShare();
                accShare3.AccountId = acclist.id;
                accShare3.UserOrGroupId = acclist.Shared_With3__c;
                accShare3.AccountAccessLevel = 'Edit';
                accShare3.OpportunityAccessLevel = 'Read';
                accShare3.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd3.add(accShare3);
                }
                if(acclist.Shared_With4__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With4__c);
                AccountShare accShare4  = new AccountShare();
                accShare4.AccountId = acclist.id;
                accShare4.UserOrGroupId = acclist.Shared_With4__c;
                accShare4.AccountAccessLevel = 'Edit';
                accShare4.OpportunityAccessLevel = 'Read';
                accShare4.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd4.add(accShare4);
                }
                if(acclist.Shared_With__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With__c);
                AccountShare accShare  = new AccountShare();
                accShare.AccountId = acclist.id;
                accShare.UserOrGroupId = acclist.Shared_With__c;
                accShare.AccountAccessLevel = 'Edit';
                accShare.OpportunityAccessLevel = 'Read';
                accShare.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd.add(accShare);
                }
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd, false);
            }
            if(!sharesToadd2.isEmpty())
            {
            Database.insert(sharesToadd2, false);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd3, false);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd4, false);
            }

        }
    
  /*  public static void manualShareEdit(Id recordId, Id userOrGroupId)
        {
        AccountShare accShr  = new AccountShare();
        accShr.AccountId = recordId;
        accShr.UserOrGroupId = userOrGroupId;
        accShr.AccountAccessLevel = 'Edit';
        accShr.OpportunityAccessLevel = 'Edit';
        accShr.RowCause = Schema.AccountShare.RowCause.Manual;
        Database.insert(accShr,false);
        }    */
    }

 
Hi , I have a requirement to generate PDF using a button on a MODAL. The MODAL displays data from a JSON object which i fetch as part of a callout.

How we can create a PDF on click of a buton in Lightning component
Hi folks, I need your help to understand whether I am doing something wrong for the below Proof of concept.

Consider there is a Third party application (anothe SF org) which is accessed through an another Salesforce org and Customer community using Connected App feature.
Now the functionality that I would like to test it if suppoer an Internal user login to community as community user using "Login to community as user" feature then on click of connected app the connected app should open in Community user context.

I did all the setup but when Connected app is clicked its using the internal user context?

Is this even possible, how salesforce "Login as community user" feature works does it loads the session in community user mode?
if I try to display the "Logged in user name, session id in a VF page" I can see the information is displayed as community user but on click of connected app it doesnt work.
Need help on best way to implement below req. Consider we have a Lightning Page to fill information. We want to launch this Page from a third party system with information pre-loaded when user clicks on the link in the external system. 
I am an Admin with no real Apex experience and need help to determine what exactly is happening in this Apex Trigger. I belive it is a trigger to share an Account record when some custom Shared With fields are populated. Trying to determine if we can do away with this trigger and utilize something simpler like Account Teams. Thanks!
 
public class ShareWithTriggerHandler {
    public static void afterInsert(Account[] accounts){
    List<AccountShare> sharesToadd = new List<AccountShare>();
    List<AccountShare> sharesToadd2 = new List<AccountShare>();
    List<AccountShare> sharesToadd3 = new List<AccountShare>();
    List<AccountShare> sharesToadd4 = new List<AccountShare>();
  AccountToContactSync acs = new AccountToContactSync();
  acs.UpdateSharedWith(accounts);
        for(Account acclist: [SELECT Id,Name,Shared_With2__c,Shared_With3__c,Shared_With4__c,Shared_With__c FROM Account WHERE Id IN : accounts])
            {
                if(acclist.Shared_With2__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With2__c);
                AccountShare accShare2  = new AccountShare();
                accShare2.AccountId = acclist.id;
                accShare2.UserOrGroupId = acclist.Shared_With2__c;
                accShare2.AccountAccessLevel = 'Edit';
                accShare2.OpportunityAccessLevel = 'Read';
                accShare2.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd2.add(accShare2);
                // Database.insert(accShr,false);
                }
                if(acclist.Shared_With3__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With3__c);
                AccountShare accShare3  = new AccountShare();
                accShare3.AccountId = acclist.id;
                accShare3.UserOrGroupId = acclist.Shared_With3__c;
                accShare3.AccountAccessLevel = 'Edit';
                accShare3.OpportunityAccessLevel = 'Read';
                accShare3.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd3.add(accShare3);
                }
                if(acclist.Shared_With4__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With4__c);
                AccountShare accShare4  = new AccountShare();
                accShare4.AccountId = acclist.id;
                accShare4.UserOrGroupId = acclist.Shared_With4__c;
                accShare4.AccountAccessLevel = 'Edit';
                accShare4.OpportunityAccessLevel = 'Read';
                accShare4.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd4.add(accShare4);
                }
                if(acclist.Shared_With__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With__c);
                AccountShare accShare  = new AccountShare();
                accShare.AccountId = acclist.id;
                accShare.UserOrGroupId = acclist.Shared_With__c;
                accShare.AccountAccessLevel = 'Edit';
                accShare.OpportunityAccessLevel = 'Read';
                accShare.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd.add(accShare);
                }
                system.debug('!!!!'+acclist);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd, false);
            }
            if(!sharesToadd2.isEmpty())
            {
            Database.insert(sharesToadd2, false);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd3, false);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd4, false);
            }

        }
    public static void afterUpdate(Account[] accounts,Map<Id,Account> oldMap)
        {
        List<AccountShare> sharesToDelete = new List<AccountShare>();
    System.debug('******BEGIN UpdateSharedWith******');
    AccountToContactSync acs = new AccountToContactSync();
    acs.UpdateSharedWith(accounts);
    System.debug('******END UpdateSharedWith******');
        for(AccountShare acclist1: [SELECT Id FROM AccountShare WHERE AccountId IN :trigger.oldMap.keyset() AND RowCause = 'Manual'])
            {
            sharesToDelete.add(acclist1);
            // List<AccountShare> sharesToDelete = [SELECT Id FROM AccountShare WHERE AccountId IN :trigger.oldMap.keyset() AND RowCause = 'Manual'];
            }
        if(!sharesToDelete.isEmpty())
            {
            Database.Delete(sharesToDelete, false);
            }
        List<AccountShare> sharesToadd = new List<AccountShare>();
        List<AccountShare> sharesToadd2 = new List<AccountShare>();
        List<AccountShare> sharesToadd3 = new List<AccountShare>();
        List<AccountShare> sharesToadd4 = new List<AccountShare>();
        for(Account acclist: [SELECT Id,Name,Shared_With2__c,Shared_With3__c,Shared_With4__c,Shared_With__c FROM Account WHERE Id IN : accounts])
            {
            if(acclist.Shared_With2__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With2__c);
                AccountShare accShare2  = new AccountShare();
                accShare2.AccountId = acclist.id;
                accShare2.UserOrGroupId = acclist.Shared_With2__c;
                accShare2.AccountAccessLevel = 'Edit';
                accShare2.OpportunityAccessLevel = 'Read';
                accShare2.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd2.add(accShare2);
                // Database.insert(accShr,false);
                }
                if(acclist.Shared_With3__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With3__c);
                AccountShare accShare3  = new AccountShare();
                accShare3.AccountId = acclist.id;
                accShare3.UserOrGroupId = acclist.Shared_With3__c;
                accShare3.AccountAccessLevel = 'Edit';
                accShare3.OpportunityAccessLevel = 'Read';
                accShare3.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd3.add(accShare3);
                }
                if(acclist.Shared_With4__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With4__c);
                AccountShare accShare4  = new AccountShare();
                accShare4.AccountId = acclist.id;
                accShare4.UserOrGroupId = acclist.Shared_With4__c;
                accShare4.AccountAccessLevel = 'Edit';
                accShare4.OpportunityAccessLevel = 'Read';
                accShare4.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd4.add(accShare4);
                }
                if(acclist.Shared_With__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With__c);
                AccountShare accShare  = new AccountShare();
                accShare.AccountId = acclist.id;
                accShare.UserOrGroupId = acclist.Shared_With__c;
                accShare.AccountAccessLevel = 'Edit';
                accShare.OpportunityAccessLevel = 'Read';
                accShare.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd.add(accShare);
                }
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd, false);
            }
            if(!sharesToadd2.isEmpty())
            {
            Database.insert(sharesToadd2, false);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd3, false);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd4, false);
            }

        }
    
  /*  public static void manualShareEdit(Id recordId, Id userOrGroupId)
        {
        AccountShare accShr  = new AccountShare();
        accShr.AccountId = recordId;
        accShr.UserOrGroupId = userOrGroupId;
        accShr.AccountAccessLevel = 'Edit';
        accShr.OpportunityAccessLevel = 'Edit';
        accShr.RowCause = Schema.AccountShare.RowCause.Manual;
        Database.insert(accShr,false);
        }    */
    }

 
Hi,
 
I'm using a visual force page and a custom controller for send an email functionality for a partner user.
Can we select a template as in standard saleforce 'send an email' functionality using visula force.
Or is there any work around solution?
 
any pointers will be od great help.
 
Thanks and Regards,
Susmitha.
  • August 28, 2008
  • Like
  • 0
Our phone system has a desktop agent that can shell out or communicate with external applications.   We have an existing application that gets account information through web services, then invokes an instance of internet explorer 6 and directs the browser to the appropriate account.  

I am performing maintenance on this application, and I'm trying to figure out how to have the application log into the SalesForce web application.   I am successfully logging in through the web service, but the web application is requiring me to log in again when I attempt to navigate to the account page. 

Given a successful login to the web service, is there a way to navigate to the account page without having to enter credentials at the login screen?

Thanks,

Jeff Penrod

I am an Admin with no real Apex experience and need help to determine what exactly is happening in this Apex Trigger. I belive it is a trigger to share an Account record when some custom Shared With fields are populated. Trying to determine if we can do away with this trigger and utilize something simpler like Account Teams. Thanks!
 
public class ShareWithTriggerHandler {
    public static void afterInsert(Account[] accounts){
    List<AccountShare> sharesToadd = new List<AccountShare>();
    List<AccountShare> sharesToadd2 = new List<AccountShare>();
    List<AccountShare> sharesToadd3 = new List<AccountShare>();
    List<AccountShare> sharesToadd4 = new List<AccountShare>();
  AccountToContactSync acs = new AccountToContactSync();
  acs.UpdateSharedWith(accounts);
        for(Account acclist: [SELECT Id,Name,Shared_With2__c,Shared_With3__c,Shared_With4__c,Shared_With__c FROM Account WHERE Id IN : accounts])
            {
                if(acclist.Shared_With2__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With2__c);
                AccountShare accShare2  = new AccountShare();
                accShare2.AccountId = acclist.id;
                accShare2.UserOrGroupId = acclist.Shared_With2__c;
                accShare2.AccountAccessLevel = 'Edit';
                accShare2.OpportunityAccessLevel = 'Read';
                accShare2.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd2.add(accShare2);
                // Database.insert(accShr,false);
                }
                if(acclist.Shared_With3__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With3__c);
                AccountShare accShare3  = new AccountShare();
                accShare3.AccountId = acclist.id;
                accShare3.UserOrGroupId = acclist.Shared_With3__c;
                accShare3.AccountAccessLevel = 'Edit';
                accShare3.OpportunityAccessLevel = 'Read';
                accShare3.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd3.add(accShare3);
                }
                if(acclist.Shared_With4__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With4__c);
                AccountShare accShare4  = new AccountShare();
                accShare4.AccountId = acclist.id;
                accShare4.UserOrGroupId = acclist.Shared_With4__c;
                accShare4.AccountAccessLevel = 'Edit';
                accShare4.OpportunityAccessLevel = 'Read';
                accShare4.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd4.add(accShare4);
                }
                if(acclist.Shared_With__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With__c);
                AccountShare accShare  = new AccountShare();
                accShare.AccountId = acclist.id;
                accShare.UserOrGroupId = acclist.Shared_With__c;
                accShare.AccountAccessLevel = 'Edit';
                accShare.OpportunityAccessLevel = 'Read';
                accShare.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd.add(accShare);
                }
                system.debug('!!!!'+acclist);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd, false);
            }
            if(!sharesToadd2.isEmpty())
            {
            Database.insert(sharesToadd2, false);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd3, false);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd4, false);
            }

        }
    public static void afterUpdate(Account[] accounts,Map<Id,Account> oldMap)
        {
        List<AccountShare> sharesToDelete = new List<AccountShare>();
    System.debug('******BEGIN UpdateSharedWith******');
    AccountToContactSync acs = new AccountToContactSync();
    acs.UpdateSharedWith(accounts);
    System.debug('******END UpdateSharedWith******');
        for(AccountShare acclist1: [SELECT Id FROM AccountShare WHERE AccountId IN :trigger.oldMap.keyset() AND RowCause = 'Manual'])
            {
            sharesToDelete.add(acclist1);
            // List<AccountShare> sharesToDelete = [SELECT Id FROM AccountShare WHERE AccountId IN :trigger.oldMap.keyset() AND RowCause = 'Manual'];
            }
        if(!sharesToDelete.isEmpty())
            {
            Database.Delete(sharesToDelete, false);
            }
        List<AccountShare> sharesToadd = new List<AccountShare>();
        List<AccountShare> sharesToadd2 = new List<AccountShare>();
        List<AccountShare> sharesToadd3 = new List<AccountShare>();
        List<AccountShare> sharesToadd4 = new List<AccountShare>();
        for(Account acclist: [SELECT Id,Name,Shared_With2__c,Shared_With3__c,Shared_With4__c,Shared_With__c FROM Account WHERE Id IN : accounts])
            {
            if(acclist.Shared_With2__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With2__c);
                AccountShare accShare2  = new AccountShare();
                accShare2.AccountId = acclist.id;
                accShare2.UserOrGroupId = acclist.Shared_With2__c;
                accShare2.AccountAccessLevel = 'Edit';
                accShare2.OpportunityAccessLevel = 'Read';
                accShare2.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd2.add(accShare2);
                // Database.insert(accShr,false);
                }
                if(acclist.Shared_With3__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With3__c);
                AccountShare accShare3  = new AccountShare();
                accShare3.AccountId = acclist.id;
                accShare3.UserOrGroupId = acclist.Shared_With3__c;
                accShare3.AccountAccessLevel = 'Edit';
                accShare3.OpportunityAccessLevel = 'Read';
                accShare3.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd3.add(accShare3);
                }
                if(acclist.Shared_With4__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With4__c);
                AccountShare accShare4  = new AccountShare();
                accShare4.AccountId = acclist.id;
                accShare4.UserOrGroupId = acclist.Shared_With4__c;
                accShare4.AccountAccessLevel = 'Edit';
                accShare4.OpportunityAccessLevel = 'Read';
                accShare4.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd4.add(accShare4);
                }
                if(acclist.Shared_With__c != null)
                {
                // manualShareEdit(acclist.id,acclist.Shared_With__c);
                AccountShare accShare  = new AccountShare();
                accShare.AccountId = acclist.id;
                accShare.UserOrGroupId = acclist.Shared_With__c;
                accShare.AccountAccessLevel = 'Edit';
                accShare.OpportunityAccessLevel = 'Read';
                accShare.RowCause = Schema.AccountShare.RowCause.Manual;
                sharesToadd.add(accShare);
                }
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd, false);
            }
            if(!sharesToadd2.isEmpty())
            {
            Database.insert(sharesToadd2, false);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd3, false);
            }
            if(!sharesToadd.isEmpty())
            {
            Database.insert(sharesToadd4, false);
            }

        }
    
  /*  public static void manualShareEdit(Id recordId, Id userOrGroupId)
        {
        AccountShare accShr  = new AccountShare();
        accShr.AccountId = recordId;
        accShr.UserOrGroupId = userOrGroupId;
        accShr.AccountAccessLevel = 'Edit';
        accShr.OpportunityAccessLevel = 'Edit';
        accShr.RowCause = Schema.AccountShare.RowCause.Manual;
        Database.insert(accShr,false);
        }    */
    }