Skip to content
This repository has been archived by the owner on Jan 27, 2024. It is now read-only.

Use Actual Related List Labels #1

Closed
douglascayers opened this issue Aug 27, 2017 · 3 comments · Fixed by #28
Closed

Use Actual Related List Labels #1

douglascayers opened this issue Aug 27, 2017 · 3 comments · Fixed by #28
Assignees
Labels
enhancement ✨ A new feature suggestion or improvement upon an existing feature. salesforce known issue ⚠️ A known issue with the Salesforce platform and likely not something the app can address.
Milestone

Comments

@douglascayers
Copy link
Owner

douglascayers commented Aug 27, 2017

Due to limitation in Apex, the SObject Describe info only provides the API name of child relationships or the label of an object, not the label of the child relationship.

See this StackExchange post about the limitation.

This means if we have an object Foo__c with two lookup fields to object Bar__c and each lookup field assigned different related list labels like "Mars Bars" and "Candy Bars" then Apex code isn't able to determine those labels. Instead, Apex SObject Describe info can tells us the API names like Mars_Bars__r and Candy_Bars__r or the labels of the Bar__c object itself: "Bar" (singular label) and "Bars" (plural label).

For now, the app displays the plural label of the object the lookup field points to. It's not ideal, but better than nothing. If you mouse over the relationship name in the vertical navigation then the tooltip that displays includes the API name of the child relationship.

This means that if a child object has multiple lookup fields to the same parent object then the Related Files lightning component will display the parent object's plural label multiple times too.

image

Cory Cowgill suggests trying to use the User Interface API but I fear it may have same limitation as Apex.

@douglascayers douglascayers added the salesforce known issue ⚠️ A known issue with the Salesforce platform and likely not something the app can address. label Aug 27, 2017
@douglascayers douglascayers self-assigned this Aug 27, 2017
@douglascayers
Copy link
Owner Author

I am of the opinion this is impossible to determine dynamically.

  • The Apex SObject Describe certainly does not provide the child relationship labels, only API names.
  • The User Interface API only provides what Apex Describe provides.
  • The Metadata API, although provides info about Related Lists in Layouts, neither provides the expected API name and does not provide any labels either.

@douglascayers douglascayers added the enhancement ✨ A new feature suggestion or improvement upon an existing feature. label Aug 29, 2017
@douglascayers
Copy link
Owner Author

douglascayers commented Sep 4, 2017

According to forward-looking statement by Kamyar Seradjfar, Salesforce is working on a Lists API that would provide more metadata information about related lists. It's yet to be seen whether this new API will provide the related list label, but one can be hopeful.

image

@douglascayers douglascayers added the status/inprogress Currently being developed for a future release. label May 19, 2019
@douglascayers
Copy link
Owner Author

Through a combination of Tooling API and Apex SObject Describe info, I've been able to determine either the related list labels, or very nearly close to it, for both standard and custom fields.

image

For standard fields, I use the Custom Relationship Name:
image

For custom fields, I use Tooling API:
image

Oddly, unfortunately, frustratingly, the way to determine the related list labels is different for standard and custom fields so the solution is a more complex than I'd like, but it works.

@douglascayers douglascayers added this to the Release 1.2 milestone May 19, 2019
@douglascayers douglascayers removed status/inprogress Currently being developed for a future release. labels May 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement ✨ A new feature suggestion or improvement upon an existing feature. salesforce known issue ⚠️ A known issue with the Salesforce platform and likely not something the app can address.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant