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
kevinvwkevinvw 

Display Opportunity Record Type Name as formula on custom Child related list

I have a custom child table that displays as a Master/Detail related list under Opportunities.

 

I would like to display the Opportunity Record Type Name as a formula in the related list.

 

But the formula editor only lets me add RecordType.Id.

 

I tried $RecordType.Name, but that only works if the Record Type is part of the current object.

My custom object doesn't have Record Types, but the Parent (Opportunity) does have Record types.

 

I can't come up with a formula that works.

 

I am thinking I may have to use a trigger.

 

Thanks,

 

Kevin.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
kevinvwkevinvw

HI 

 

 

 

 

Kevin.

 

All Answers

Ispita_NavatarIspita_Navatar

I recently solved a similar requirement and the solution is very simple.

You can do the following to achieve you requirement:-

1. Create a custom field OppRecordName of type text.

2. Create a Workflow Rule  :-

      i.   which fires on edit and create of opportunity

      ii. put triggering condition as say RecordTypeName= 'X'

      iii. put field update say Set the custom field you created above to 'X"

      iv. if you have 5 record types you have to put 5 such WFRs

3. Now create another custom field in the child object of opportunity of type formula and datatype text and set the value of this field in the formula to opportunity.RecordTypeName__c

 

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

 

 

 

 

kevinvwkevinvw

HI 

 

 

 

 

Kevin.

 

This was selected as the best answer
BrianHBrianH

I am running into the same issue.  I understand that I can go ahead and create a workflow or trigger to resolve it.  However, I'm just curious why Salesforce won't allow us to do this through a formula field?

I have a formula field on the opportunity object that contains "$RecordType.Name".  This is used to display the record type name for that opporutnity. The API field name for this custom field is RecordTypeName__c

 

I also need to display this on the "opportunity product" child object.  If I create a formula field on the child object, insert a field, and select the RecordTypeName__c field from above, I receive the below error.  It just doesn't make sense to me why I am unable to do this.

Error: Error in referenced formula Opportunity.RecordType__c, Field $RecordType.DeveloperName does not exist. Check spelling.

Steve :-/Steve :-/

I don't think that you can get a handle to your Opportunity Record Type formula(Text) field on "the fly" like that from the Opportunity Line Item -> Opportunity Product Level.  

You might have to reference the "raw" Opportunity.RecordTypeId and translate it from ID to Name using a CASE or IF function

Song HarverySong Harvery
just use  Opportunity.RecordType.DeveloperName  in formular field.