You need to sign in to do that
Don't have an account?
Kasia Wojewodzka 7
Prevent change of record type - Validation Rule Adjustment
Hello
Hoping that you can help me!
I would like to modify this Validation rule to use for example Case Record Type Name or Case Record Type Developer Name instead of hardcoded Ids.
When I tried to replace RecordTypeId = '0123Z000000LKZa' with RecordType.Name I received the error:
PRIORVALUE function cannot reference the RecordType.Name field.
Here is my validation rule:
AND
(
RecordTypeId = '0123Z000000LKZb',
ISCHANGED(RecordTypeId),
PRIORVALUE(RecordTypeId) = '0123Z000000LKZa',
$Profile.Name <> "System Administrator",
$Profile.Name <> "System Integration",
$Profile.Name <> "CRM Team"
)
Hoping that you can help me!
I would like to modify this Validation rule to use for example Case Record Type Name or Case Record Type Developer Name instead of hardcoded Ids.
When I tried to replace RecordTypeId = '0123Z000000LKZa' with RecordType.Name I received the error:
PRIORVALUE function cannot reference the RecordType.Name field.
Here is my validation rule:
AND
(
RecordTypeId = '0123Z000000LKZb',
ISCHANGED(RecordTypeId),
PRIORVALUE(RecordTypeId) = '0123Z000000LKZa',
$Profile.Name <> "System Administrator",
$Profile.Name <> "System Integration",
$Profile.Name <> "CRM Team"
)
You can't use recordtype.Name for ISCHANGED() & PRIORVALUE() functions.
As an alternative, refer below solutions.
https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8JyMSAV
https://developer.salesforce.com/forums/?id=9062I000000XvPWQA0
If this helps, Please mark it as best answer.
Please let me know if any help required.
Thanks!!
I found the solution: I created 2 custom Labels and used those in my Validation rule.
AND
(
RecordTypeId = $Label.CAG_Ref_Lab_Quick_Case_Record_Type,
ISCHANGED(RecordTypeId),
PRIORVALUE(RecordTypeId) = $Label.CAG_Ref_Lab_Case_Record_Type,
$Profile.Name <> "System Administrator",
$Profile.Name <> "System Integration",
$Profile.Name <> "CRM Team"
)