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
vgorgolvgorgol 

Prevent Record Type from Changing

I am attempting to create a validation rule on Opportunities that will prevent certain types of users from changing the record type. I know how to limit by profile, no worries there, but I cannot seem to find a way to tell if the record type value has changed from one type to another.

 

ISCHANGED does not work when I attempt to access one of the record type fields, and the field RecordType does not exist according to the syntax editor.

 

Any ideas out there?

Best Answer chosen by Admin (Salesforce Developers) 
vgorgolvgorgol
I had though about using a custom field for that purpose, but was hoping to avoid it.

Actually, I just found a better way. I had forgotten that the Formula Editor doesn't actually provide the correct field in this case.

I couldn't use the RecordType field (it couldn't find it) and I could use the lookup variables directly with ischanged (ischanged(recordtype.name)).

The solution I found was to use ischanged(RecordTypeId). This works great.

Thanks for your reponse though! Always appreciated.

All Answers

Rahul_sgRahul_sg

To reference Record Types by name rather than ID, create a custom Formula field on your Oppty object

DataType:  Formula(Text)
Formula: $RecordType.Name

Now you can reference this field in your validation formulas 

vgorgolvgorgol
I had though about using a custom field for that purpose, but was hoping to avoid it.

Actually, I just found a better way. I had forgotten that the Formula Editor doesn't actually provide the correct field in this case.

I couldn't use the RecordType field (it couldn't find it) and I could use the lookup variables directly with ischanged (ischanged(recordtype.name)).

The solution I found was to use ischanged(RecordTypeId). This works great.

Thanks for your reponse though! Always appreciated.
This was selected as the best answer