Record types allow you to offer different
business processes, picklist values, and page layouts to different
users based on their profiles. Therefore sometimes requirement arises in which validation's are made on the basis of record types.
For example in my case I have a Booking(Booking__c) custom field for which I have a custom field of picklist type name as Status and have values as shown below:-
Therefore now we have a custom object "Booking' and a Picklist field for this object name as "Status" with values Not Confirmed, Confirmed, Check In, Check Out.
I have a Record Type Name as "Booking Help" for Booking Object as shown below:--
I'm trying to write a validation rule that is dependent on the Record Type. For example:
Validation is there for ensuring that If record Type is "Booking Help" and New Booking Record is going to be insert in the database then Status should be Confirmed. if not then it will throw an error "Status should be Confirmed during new booking record insertion".
When I look at my choices for Record Type, I only find Record Type ID, but I can only find the Record Type name in the back-end. By using that I made a validation as shoen below:--
But when I do testing for this validation then it fails. Now I make some changes in my validation formula and it result me as success.
Finally If we talk in details then we can say that in case of validation through record type always use formula $RecordType.Name of global type in place of using reference of Record Types through ID.
For example in my case I have a Booking(Booking__c) custom field for which I have a custom field of picklist type name as Status and have values as shown below:-
Therefore now we have a custom object "Booking' and a Picklist field for this object name as "Status" with values Not Confirmed, Confirmed, Check In, Check Out.
I have a Record Type Name as "Booking Help" for Booking Object as shown below:--
I'm trying to write a validation rule that is dependent on the Record Type. For example:
Validation is there for ensuring that If record Type is "Booking Help" and New Booking Record is going to be insert in the database then Status should be Confirmed. if not then it will throw an error "Status should be Confirmed during new booking record insertion".
When I look at my choices for Record Type, I only find Record Type ID, but I can only find the Record Type name in the back-end. By using that I made a validation as shoen below:--
But when I do testing for this validation then it fails. Now I make some changes in my validation formula and it result me as success.
Finally If we talk in details then we can say that in case of validation through record type always use formula $RecordType.Name of global type in place of using reference of Record Types through ID.
|
I found your blog very useful. You have explained this thing in a very simple and narrative manner.
ReplyDeleteKeep up the good work going.
SEO Melbourne