Salesforce Fact #514 | Previous record type check in validation rule

Suppose we have a use case where we need to check previous record type name in order to put some validation when the record type is changed on the record.

Now, the limitation is PRIORVALUE() cannot take RecordType.Name or RecordType.DeveloperName as parameter. So, to resolve this we can create a formula field of text type which will hold the value of RecordType.DeveloperName and we can use this field along with PRIORVALUE() in our validation rule.

In this example, there are two record types: Test_RT1 and Test_RT2 in Account and we want to restrict the record type change from Test_RT1 to Test_RT2.

Attached are the screenshots.




Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow