You need to sign in to do that
Don't have an account?
Learnerrr
Any Other way to refer record type except record type ID because sand box will not refer the same id to select record type
else if(ApexPages.currentPage().getParameters().get('RecordType') =='0127F000000erM4'){ PageReference pageRef1 = new PageReference('/apex/Case_CustomEditPage'); pageRef1.setRedirect(true); return pageRef1; }
Never use hardcoded Ids
you can use following for ur requirement -
Here Case is the Object name, Assignement is my record type name
All Answers
Never use hardcoded Ids
you can use following for ur requirement -
Here Case is the Object name, Assignement is my record type name
you can Query from recordtype object with name to filter the results. store it in variable and check it in the if condition.
1. By using custom label :
Just create a custom label with recordtype id value and use same custom label in your apex class
e.g. Let say label created --> ACCOUNT_RECORDTYPE
2. Using Schema Class :
E.g. Suppose you want to retrieve Id of a record type of Account object and record type label is 'IT Industry' Here to avoid hard-coding you can use record type’s label as custom label, custom settings or custom metadata.
3. As a utility method (Similar to 2nd one) :
You can add a utility method in your class or in common utility class in which you can pass name of sObject and record type label which returns recordtypeid.