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
Shree KShree K 

How to use Record Type without hard coding them in the formulas?

Hi All,
Can someone help me on how to make use of Record Types in formulas instead of using their Ids? so that the formula would be working for records created by that particular Record Type,

For Example how can i avoid using Ids in the below formula
IF( 

AND( 
ISNULL(Request_Date__c) 
,	
( 
RecordTypeId = '01234567Abcdefg' 
|| 
AND( 
NOT(ISBLANK(Text(Process_Type__c))) 
, 
RecordTypeId = '7654321Abcdefgh' 
) 
) 
)

 
Naval Sharma4Naval Sharma4
You can use Custom Labels or Custom Setting to hold these values. 
Also, RecordType.Name should work
NagendraNagendra (Salesforce Developers) 
Hi,

You can use custom setting for this. Keep the record type Id in a custom setting and use that in your button code, it will look something like this "{!$Setup.CustomSettingAPI_c.RecordTypeId_c}"

For more information on similar issue may I suggest you please check with below link with a similar issue and a suggested workaround.
  • https://salesforce.stackexchange.com/questions/1626/refer-to-record-type-id-in-formula-without-hard-coding
Hope this helps.

Kindly mark this as solved if it;s resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Thanks,
Nagendra
NagendraNagendra (Salesforce Developers) 
Hi,

You can use custom setting for this. Keep the record type Id in a custom setting and use that in your button code, it will look something like this "{!$Setup.CustomSettingAPI_c.RecordTypeId_c}"

For more information on similar issue may I suggest you please check with below link with a similar issue and a suggested workaround. Hope this helps.

Kindly mark this as solved if it;s resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Thanks,
Nagendra
RD@SFRD@SF
Hi CkRdY,

Also, in the formula's you can use the recordtype.Developername field instead of Id. You should be able to use the recordtype name to compare against the specific recordtype name you want the formula to work for.

Hope it helps
RD
Shree KShree K
Hi All,
Thanks to all of you for taking time to reply,based on your replies i have realised that probably Hyerarchical CS can solve my problem but there are two concerns here 1) I would like to use RectypeIds, which should be available regardless of the Profile or user, 2) i'm facing syntax errors when used below syntax in the formula 
!$Setup.CustomSettingName__c.CustomFieldName__c