[SalesForce] Translated related list label in salesforce

I overrode a related list label using translation workbench. How do I get the translated related list label in apex?

I tried with Schema.getChildRelationships(), but no luck.

Thanks in advance.

Best Answer

I haven't tried it, but how about something like:

Schema.DescribeSObjectResult describe = Account.SObjectType.getDescribe();
List<Schema.ChildRelationship> childRelationships = describe.getChildRelationships(); 

for(Schema.ChildRelationship cr : childRelationships){
    Schema.DescribeFieldResult dfr = cr.getField().getDescribe();

    System.debug('Label:' + dfr.getLabel();

Feel free to ignore if this lines up with what you have already tried.

From the docs for DescribeFieldResult.getLabel():

Returns the text label that is displayed next to the field in the Salesforce user interface. This label can be localized.

I found two ideas that are roughly related to labels in general (not directly to translations):

  1. Add Apex API for Custom Labels
  2. need to add relationshipLabel into partner / enterprise wsdl
Related Topic