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
Ann BeattieAnn Beattie 

Validation Rule, user not SysAdmin

User cannot change record owner If user is not System Admin, Industry is null and Account created after 1/1/2017
I tried this formula where the Profile Id is for System Administrator  but it fires even if the System Admin is editing the record.
$User.ProfileId  <> "0ei0000001DLN6"&&
 ISCHANGED( OwnerId )&&
 ISBLANK(TEXT(Industry ))&&
  DATEVALUE(CreatedDate) > DATE(2017,01,01)
 
Best Answer chosen by Ann Beattie
Maharajan CMaharajan C
Hi Ann,

Your formula looks good. But don't use the hardcoded id in formula. May be you are using the wrong id.

I tried the below formula in my org it's working fine. Try the below one.
 
AND(
$Profile.Name <> 'System Administrator',
ISCHANGED( OwnerId ),
ISBLANK(TEXT(Industry )),
DATEVALUE(CreatedDate) > DATE(2017,01,01)
)

Thanks,
Maharajan.C

All Answers

Maharajan CMaharajan C
Hi Ann,

Your formula looks good. But don't use the hardcoded id in formula. May be you are using the wrong id.

I tried the below formula in my org it's working fine. Try the below one.
 
AND(
$Profile.Name <> 'System Administrator',
ISCHANGED( OwnerId ),
ISBLANK(TEXT(Industry )),
DATEVALUE(CreatedDate) > DATE(2017,01,01)
)

Thanks,
Maharajan.C
This was selected as the best answer
Ashish Kumar YadavAshish Kumar Yadav
@Ann Beattie 
Please try below Validation rule.if this is work please mark as a best answer.

AND(
$Profile.Name <> 'System Administrator',
OR(
ISCHANGED( OwnerId ),
ISBLANK(TEXT(Industry )),
DATEVALUE(CreatedDate) > DATE(2017,01,01)
)
)