tprouvot / Salesforce-Inspector-reloaded

Chrome extension to add a metadata layout on top of the standard Salesforce UI to improve the productivity and joy of Salesforce configuration, development, and integration.
https://chrome.google.com/webstore/detail/salesforce-inspector-relo/hpijlohoihegkfehhibggnkbjhoemldh
MIT License
206 stars 62 forks source link

[popup] SF Inspector does not show record name without a defined Name field #274

Open JA-Brightgen opened 9 months ago

JA-Brightgen commented 9 months ago

Make sure to read the troubleshooting section before creating an issue

Describe the bug In cases where an sObject does not have a Name field, the (Record) Name field of the popup is blank when viewing a record. Affected objects are typically standard objects that use an auto-number as an identifier - examples include Case, Contract, and WorkOrder.

To Reproduce Steps to reproduce the behavior:

  1. Go to a record on any affected object (eg. Case)
  2. Open the SF Inspector popup on the page
  3. View the second Name: field
  4. No value will be shown

Expected behavior A value for the Name: field should exist for any record.

Screenshots nameless2

Desktop (please complete the following information):

Additional context In these cases, the field which is meant to be used as the identifier typically has the property idLookup (As an example see the CaseNumber field of the Case Object Reference docs)

JA-Brightgen commented 9 months ago

In these cases, the field which is meant to be used as the identifier typically has the property idLookup (As an example see the CaseNumber field of the Case Object Reference docs)

Although not listed in the docs, it appears there is also a nameField property on these which might be more reliable as it's also set on normal Name fields (eg. Account.Name) too:

caseNumberMeta
tprouvot commented 9 months ago

Hi @JA-Brightgen, This is true, most of the Sobjects have the Name field but not all of them.

The goal of this feature is to provide minimal info (and link) on the record when searched from the id in the Object tab without extra treatment or rest callout. When implementing the feature I've considered to use the nameField boolean but this would require an extra callout (or passing the entitydefinition results) and appeared as overkill for a minimal benefit.

JA-Brightgen commented 9 months ago

Hey @tprouvot,

Understandable you wouldn't want to introduce new callouts just for this.

My Plan B that wasn't pretty but seems to cover all the sObjects I can think of would be to fallback onto potential field names in the order Name, LineItemNumber, <sObjectName>Number, but as you say you'd still need to introduce additional callouts to go down this route as well.

I'll mark it as Won't Fix for now then, if I have any bright ideas I'll revisit this later on :)

tprouvot commented 9 months ago

@JA-Brightgen I could dynamically build the Number field name and add it to the queried fields but this would throw an error in chrome console for each query (since we can't have both fields) and this won't add a new query.

I'll try to find a way to do it without throwing an error (because the actual implementation also does when there's no "Name" field which is not good..)