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
Supriyo Ghosh 5Supriyo Ghosh 5 

Validation rule is not working.

I have written a validation rule but it is not working.Please help.

(ISCHANGED(Date_of_Birth__c)) &&($User.ProfileId<>'00e90000001TW6p')

DOB cannot be change other than system admin.
Best Answer chosen by Supriyo Ghosh 5
Dutta SouravDutta Sourav
Hi Jambert,
Birthdate is a Standard Field of Account if Person Account is activated to that Org.
There must be Person Account Activated in this Org.

@Supriyo:
We were trying with Custom Field as you mentioned the API Names in the question.

Now Try this:
AND(
PRIORVALUE(PersonBirthdate)<>NULL ,
ISCHANGED(PersonBirthdate),
NOT($Profile.Name<>'System Administrator')
)
Kind Regards.
Sourav.
 

All Answers

Vijay NagarathinamVijay Nagarathinam
HI Supriyo,

Check the conditons in the below way,
 
AND(ISCHANGED(Date_of_Birth__c),$Profile.Name <> "System Administrator")

Let me know if you need any help regarding this.

Thanks,
Vijay
Dutta SouravDutta Sourav
Hi Supriyo,
Try this:
AND(
ISCHANGED(Date_of_Birth__c),
 $Profile.Id<>'00e90000001TW6p'
)

Kind Regards,
Sourav.
Supriyo Ghosh 5Supriyo Ghosh 5
I have written this but still it is not working.I am doing this validation on account object.Please help.

AND(ISCHANGED(Date_of_Birth__c),$Profile.Id<>'00e90000001TW6p')
Vijay NagarathinamVijay Nagarathinam
Hi,

Please check the validation rule is active or not.

Thanks,
Vijay
Supriyo Ghosh 5Supriyo Ghosh 5
Yes it is active.
Vijay NagarathinamVijay Nagarathinam
Hi Supriyo,

I tried the same validation rule in my developer org, its working for me. Do not hard code the Ids. Use global variable to check the condtions.

Thanks,
Vijay
Dutta SouravDutta Sourav
Sorry!! Didn't notice your requirement.
Your reqirement is: DOB cannot be change other than system admin.

Try this:
AND(
ISCHANGED(Date_of_Birth__c),
 NOT($Profile.Id<>'00e90000001TW6p')
)

Kind Regards,
Sourav.
Supriyo Ghosh 5Supriyo Ghosh 5
Its still not working.My requirment if the account object field DOB having a value then other than sys admin no one can change the value.Please help.
Vijay NagarathinamVijay Nagarathinam
Hi Supriyo,

Your requeirement is dont allow to change the DOB value excpet system admin, here you need to allow to change value from null to value? Once the DOB has some date then dont allow to change any user right?

Thanks,
Vijay
Supriyo Ghosh 5Supriyo Ghosh 5
yes correct.if the DOB field have some value then no should change that value excepy admin.
Dutta SouravDutta Sourav
Hi Supriyo,
Try This:
AND( 
PRIORVALUE(Date_of_Birth__c)<>NULL , 
ISCHANGED(Date_of_Birth__c), 
NOT($Profile.Id<>'00e90000001TW6p')
)

Kind Regards,
Sourav
Vijay NagarathinamVijay Nagarathinam
Use the below rule, it will work.
 
PRIORVALUE(Dob__c) != null && ISCHANGED(Dob__c) && $Profile.Name != 'System Administrator'

Let me know if you need any help regarding this,

Thanks,
Vijay
Supriyo Ghosh 5Supriyo Ghosh 5
I don't know why but still it is not working.

AND( 
PRIORVALUE(Date_of_Birth__c)!=NULL && 
ISCHANGED(Date_of_Birth__c)&& 
$Profile.Name != 'System Administrator' 
)
venkat-Dvenkat-D
Try 
AND( 
PRIORVALUE(Date_of_Birth__c)!=NULL,
ISCHANGED(Date_of_Birth__c),
$Profile.Name != 'System Administrator' 
)
Vijay NagarathinamVijay Nagarathinam
 HI Supriyo,

Please check the below validation rule, it will work, 
 
((ISCHANGED(DOB__c)) && (PRIORVALUE(DOB__c) != DOB__c) && $Profile.Name != 'System Administrator')

Thanks,
Vijay
Supriyo Ghosh 5Supriyo Ghosh 5
@Vijay it is still not working.I am using standrad Object Account and also standrad field Birthday.If that birthday field having any value then except admin no one will change that value.
JAMBERT JESUDASANJAMBERT JESUDASAN
Hi Supriyo,

Birthday is Standard or Custom field???  In account object there is no Standard field called "Birthday".. Please let me know, wether it's Standard or Custom Field????
Supriyo Ghosh 5Supriyo Ghosh 5
it is a standrad field.Exact name Birthdate.
Dutta SouravDutta Sourav
Hi Jambert,
Birthdate is a Standard Field of Account if Person Account is activated to that Org.
There must be Person Account Activated in this Org.

@Supriyo:
We were trying with Custom Field as you mentioned the API Names in the question.

Now Try this:
AND(
PRIORVALUE(PersonBirthdate)<>NULL ,
ISCHANGED(PersonBirthdate),
NOT($Profile.Name<>'System Administrator')
)
Kind Regards.
Sourav.
 
This was selected as the best answer
Supriyo Ghosh 5Supriyo Ghosh 5
It Is working fine.
Vijay NagarathinamVijay Nagarathinam
Now its working?
Dutta SouravDutta Sourav
Glad to know that mate.

Cheers!
Sourav.