You need to sign in to do that
Don't have an account?
Vijayakumar Kenchugundu
RecordTypeId in Validation Rule is not firing
Friends,
I have written a validation rule on Account object to stop saving if Account record type id is of certain type. I know it is advisable to use RecordTypeId instead of RecordType.Name. Here is my validation rule formule:
IF( RecordTypeId = "0122i000000613oAAA",
true,
false)
It is not stopping Saving the record if the recordtypeid is 0122i000000613oAAA. It is very strange. Any thoughts to overcome this are highly appreciable.
I have written a validation rule on Account object to stop saving if Account record type id is of certain type. I know it is advisable to use RecordTypeId instead of RecordType.Name. Here is my validation rule formule:
IF( RecordTypeId = "0122i000000613oAAA",
true,
false)
It is not stopping Saving the record if the recordtypeid is 0122i000000613oAAA. It is very strange. Any thoughts to overcome this are highly appreciable.
as per your requirment that Why Validation is not work at recordType
find your solution from below info.
Actual RecordTypeId is eighteen(18) characters but in validation rule when we use RecordTypeId that time it only generate fiften(15) charctor that's why our validation not work but if you want to use validation rule then you have to take 15 letter Id like below.
Actual RecordTypeId => 0125g000000p3wnAAA with 18 letters but i'd only 15 letter.
I think above info will be enough for understanding.
let me know if it helps you and don't forget to mark it as best answer.
Thank you
All Answers
You can use RecordType.DeveloperName instead of RecordTypeId.
Thanks,
Pranali
If I use .DeveloperName, if we change the name later in future to different name, then the validation rule will fail. Can you please confirm the DeveloperName is never going to change though the RecordType.Name is changed?
try following trigger for this requirment. we have to use trigger for this requirment because your can even change developerName.so use trigger and close your query by marking it as best answer.
let me know if it helps you and marking it as best answer.
Thank you
Your trigger should work. But I would like to know why can't I use the below. Any thoughts?
IF( RecordTypeId = "0122i000000613oAAA",
true,
false)
Please check below link which has explanation for use case
Instead of hardcoding the id's you can use RecordType.DeveloperName = "API name of record type" or RecordType.Name = "Label name of record type". If you still want to use Recordid try using "RecordType.Id"
reference:
https://salesforce.stackexchange.com/questions/311112/validation-rule-to-prevent-creating-records-of-certain-record-type-not-working
If it helps mark it as best answer.
Thanks!
as per your requirment that Why Validation is not work at recordType
find your solution from below info.
Actual RecordTypeId is eighteen(18) characters but in validation rule when we use RecordTypeId that time it only generate fiften(15) charctor that's why our validation not work but if you want to use validation rule then you have to take 15 letter Id like below.
Actual RecordTypeId => 0125g000000p3wnAAA with 18 letters but i'd only 15 letter.
I think above info will be enough for understanding.
let me know if it helps you and don't forget to mark it as best answer.
Thank you
The resolution for my question is: Use 15 letter Id worked. And RecordType.Id did not work.
Thanks everyone for your thoughts. Much appreciated.