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
Miranda L 2Miranda L 2 

Validation rule not to display themself as manager

Hello there,
How to create validation which should not display themself as their manager or some lines of code to not to display them or ignore them to display themself as their own manager.
Please guide
Miranda L 2Miranda L 2
here we have a field in Invoice where triggers check their manager if they do not have manager then they display themself as their own manager but there are some users who we do not have manager but we do not want to display them their own manager so how could I do that.
here is our trigger code
for(Account A: [SELECT id, name, Owner.Name,Owner.manager.name FROM Account WHERE Owner.isActive = true AND ID IN: invoicesPerAccount.keyset()]){
            for(Invoice__c I: invoicesPerAccount.get(A.id)){
                I.Account_Owner_on_Signing_Date__c = A.Owner.Name;
                if(A.Owner.manager.name !=null){
                    I.SDOnSigningDate__c =A.Owner.manager.name;
                    System.debug('here is manager ++++ '+I.SDOnSigningDate__c);
                }else
                    I.SDOnSigningDate__c =A.Owner.Name;
                System.debug('here is empty manager*** '+A.Owner.Name);                
            }
        }

Please guide me to ignore those specific users
Simr KaurSimr Kaur
what a nice information you shared here. Keep posting this kind of stuff. check all updats https://ysrrythubharosa.in/ about government scheme.