+ Start a Discussion
BabluBablu 

Validation rule to prevent user from changing record types

Hi, 

I have 4 record types ( Business1, Business2, Business3, Business4). I want to prevent users from changing record type to Business4 from any other (Busiess1,2,3)

Please advise. Thanks 

Banti 

 
Best Answer chosen by Bablu
Melissa HallMelissa Hall
If users should never change the value to Business4 for any reason, you don't need to worry about a validation.  The best way to handle this is to not give them access to Business4 at all.

Record Type access is controlled at the profile level.  If you go into the profile and go to the Record Type Settings section.  Select Edit and move the Business4 value to the left column (Available Record Types).  Users will still be able to view Business4 records, but will not be able to create or select them from their picklist.

Record Type Settings

If you need to update a Permission Set, you'll go into the Permission Set, and choose the object that contains the record type.  In the Record Type Assignments section, you'll only select the record types that the user should use.

Permission Set Record Type Settings
Let me know if this is what you were looking for.

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Please try below code. I hope that will help u
AND
(
	RecordType.Name = 'Business4',
	IsChanged(RecordTypeId)	
)

Please let us know if this will help u
 
BabluBablu
Hi Amit,

I don't want to change the record type to Business4 from any other . It should restrict. Its seems it allows ?
Hitendar Singh 9Hitendar Singh 9

Hi 

Use the below in validation rule. This will prevent user from selecting recordtype as business4 from any other record type

(recordtype = 'Business4') && NOT(ISBLANK(PRIORVALUE(recordtype)))

Hope this helps
BabluBablu
Hi Amit and Hitendar, thanks both of you for the help.

I need to exclude admin form this validation. so admin profile users can change it ? could you please help on this
Amit Chaudhary 8Amit Chaudhary 8
Please try below validation rule.
AND
(
	RecordType.Name = 'Business4',
	IsChanged(RecordTypeId)	,
	$Profile.Name!='System Administrator' 
)

Please let us know if this will help u
 
Hitendar Singh 9Hitendar Singh 9
AND
(​
(recordtype = 'Business4') ,
NOT(ISBLANK(PRIORVALUE(recordtype))),
$Profile.Name!='System Administrator'
)
BabluBablu
Hi, I am getting the validation message when i try to change the record type to business1, 2, 3 also.. but as per the requirement it should only fire when i try to change it to Busiess4 only.
italiahallitaliahall
Try this:

AND (
RecordTypeID = '01217000000XXX4',
OR (PRIORVALUE(RecordTypeID) = '01217000000XXX1',
PRIORVALUE(RecordTypeID = '01217000000XXX2',
PRIORVALUE(RecordTypeID) = '01217000000XXX2'),
$Profile.Name!='System Administrator'
)

Replace 01217000000XXX1 with the ID for Business1, 01217000000XXX2, for Business2, etc.
BabluBablu
Hi Melissa, Thanks for the reply, but it is not working.

Scenario1 : when i am changing from Business1 to Business2 (validation message getting)
                  when i am changing from Business2 to Business3 (validation message getting)
                  when i am changing from Business1 to Business3 (validation message getting)

Validation message should get only when i try to change to Business4 from any others (From Business1,2,3)

Could you please help to acheive this ?  

Thanks in advance 

 
Melissa HallMelissa Hall
Bablu, with a fresh brain this morning I was able to drastically simplify the validation.  I just tested this in my sandbox, and it works the way you are requesting.  I can change the Record Type to a non-Business4 Record Type as much as I want and the validation is not triggered.  The moment I save the page with the Business4 Record Type, I can no longer change the Record Type unless I'm in the System Administrator profile.

AND (
PRIORVALUE(RecordTypeID) = '01217000000XXX4',
$Profile.Name!='System Administrator'
)
Melissa HallMelissa Hall
Oops, I read the request incorrectly.  You said you DON'T want them to switch to Business4, correct?  Can they never use Business4, or just not change to Business4 from Business1?  If they should never use Business4, you can remove it from the RecordType selection in their profile.  If it's the latter, I'll go back to the drawing board, and work out the proper validation.
BabluBablu
Hi Melissa,

My requirement is : User should not select Busiess- 4 From any other values. 
Currently i have 4 values in Picklist : Business1, Busiess2, Business3, Busiess4.

User can select/update among these values only : Business1, Business2, Business3 but should not touch Business4.

Few Scenarios to understand better :
1. User can change from Business1 to Buiness2
    User can change from Business2 to Business 3
    User can change from Buisess 3 to Business 1
   User can change from Buisness 3 to Busiess 2 

2. User should not change from Buiness 1 to Business 4
   User should not change from Buiness 2 to Business 4
    User should not change from Buiness 3 to Business 4
   User should not change from None to Busiess 4 also 

Could you please help in this way 


Thank you very much for your help 
Melissa HallMelissa Hall
If users should never change the value to Business4 for any reason, you don't need to worry about a validation.  The best way to handle this is to not give them access to Business4 at all.

Record Type access is controlled at the profile level.  If you go into the profile and go to the Record Type Settings section.  Select Edit and move the Business4 value to the left column (Available Record Types).  Users will still be able to view Business4 records, but will not be able to create or select them from their picklist.

Record Type Settings

If you need to update a Permission Set, you'll go into the Permission Set, and choose the object that contains the record type.  In the Record Type Assignments section, you'll only select the record types that the user should use.

Permission Set Record Type Settings
Let me know if this is what you were looking for.
This was selected as the best answer
BabluBablu
Thaks Melissa..It works