There is a custom object "XYZ" which has a picklist field "F1" with values 1, 2, 3, 11, 12, 13. There are two record types "A" and "B". For A, F1 has 1,2,3 set and for B, F1 has 11, 12, 13 set. User A creates a record R1 for XYZ with record type A and the value for F1 is 1. Now, the admin changes the record type of record R1 to B and then he sees the value 1 still in the picklist F1 while the available values should be 11, 12, 13. Is there a way so that the inapplicable value is not shown on record type change?
Actually you have two options to prevent situations as you have described. First option is to create validation rule on XYZ object that will check is value in picklist is related to record type. Follow the example:
OR( AND( RecordType.Name = 'A', OR( ISPICKVAL(F1__c, '11'), ISPICKVAL(F1__c, '12'), ISPICKVAL(F1__c, '13') ) ), AND( RecordType.Name = 'B', OR( ISPICKVAL(F1__c, '1'), ISPICKVAL(F1__c, '2'), ISPICKVAL(F1__c, '3') ) )
Second option is using Workflow Rule that will run everytime when user changes record type of XYZ object.
Follow the rule criteria:
This workflow should execute field update that will set picklist value. It is very easy to create it. During creation of workflow you should add new action, choose field update as a action type and select field to update (your picklist F1). You should be able to set this value to '-- None --'. If you want set it to first value that is related to record type, you have to create workflow rules for each record type. Each of them will be fired when user changes record type to value that is handled by workflow.
I think that only way is to update this field either by workflow or by trigger. That's because picklist is in fact some text field. You could think about 2 field set, one for each recordtype, and check in trigger if current value belongs to recordType if it doesn't put for example ' ---- None --- '. This solution allows you to change record Type without causing any error.
If you don't mind force user to set proper value you can use validation rule or validation in code.
For these cases, my advise would be to empty these fields on-change of the record type. You can do this through a regular workflow that's triggered on change of the record type.
This is offcourse only possible if you don't have any validation rules in place that make the field required.
Another option that I would think of is to streamline the process of changing the recordtype through a visual flow. There, you could make the user who changes the recordtype aware that he also needs to update this picklist field value.
One suggestion, in the success community, is to use a custom button to change your record type, set the fields to --None-- and then take the user to the edit page. https://success.salesforce.com/answers?id=90630000000hYosAAE