Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOQL Query Builder - Add Ability to Traverse Relationship Fields #186

Closed
AndyHaas opened this issue Mar 3, 2023 · 4 comments
Closed

SOQL Query Builder - Add Ability to Traverse Relationship Fields #186

AndyHaas opened this issue Mar 3, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@AndyHaas
Copy link

AndyHaas commented Mar 3, 2023

Would love the ability to traverse to the relationship field for the filter conditions section

Example Query

SELECT Id, NamespacePrefix
FROM FieldDefinition
WHERE DataType = 'Picklist'
	AND (NOT DeveloperName LIKE '%__%')
	AND EntityDefinition.DeveloperName = 'Contact'

Screenshot 2023-03-03 150435

@AndyHaas AndyHaas added the enhancement New feature or request label Mar 3, 2023
@paustint
Copy link
Contributor

paustint commented Mar 4, 2023

@AndyHaas - The issue is that EntityDefinition is some special thing in Salesforce where it technically is a relationship field but the metadata definitions salesforce returns treat it as a text field.

I think I have mocked these types of relationships to fake it in some other places, I will see if I can do the same here.

image

@paustint
Copy link
Contributor

paustint commented Mar 4, 2023

There are two issues here:

  1. Entity definition is listed as text (but does have reference info - so it is fairly easy to have code work around this)
  2. Related fields only show up in filters if they are also selected in the query

After fixing #1, #2 still has an issue - temporary workaround is to include any relationship fields from WHERE clause in the query. (see below)

The reason why all relationship fields are not included in filters is performance related - a huge list is really slow to render, but could probably be solved with a virtual scrolling list.

SELECT Id, NamespacePrefix, EntityDefinition.DeveloperName
FROM FieldDefinition
WHERE DataType = 'Picklist'
	AND (NOT DeveloperName LIKE '%__%')
	AND EntityDefinition.DeveloperName = 'Contact'

paustint added a commit that referenced this issue Mar 5, 2023
add virtual scrolling to combobox

#186
paustint added a commit that referenced this issue Mar 5, 2023
Some relationships are listed is text, but have reference info for related object

Show all related base+1 fields in combobox and any other expanded object

There is a performance impact of showing so many items in a list

#186
paustint added a commit that referenced this issue Mar 5, 2023
@AndyHaas
Copy link
Author

AndyHaas commented Mar 6, 2023

I didn't think I saw this on Standard Objects either. I just happened to be on the Entity object as I saw this.

@paustint paustint changed the title SQOL Query Builder - Add Ability to Traverse Relationship Fields SOQL Query Builder - Add Ability to Traverse Relationship Fields Mar 9, 2023
@paustint
Copy link
Contributor

This issue has been resolved.

  1. All related fields one level deep will be automatically available in query filters and order by dropdown
  2. If you visit an object more than 1 level deep (even if you do not select any fields) the object's fields are available for query filters and order by
  3. Restoring a query should work properly for related fields included in query (AFAIK the level of traversal should not matter, tested up to 3 levels and it worked)
  4. Field dropdown for filters and order by uses virtual scrolling since the list can be pretty huge and caused performance issues otherwise
  5. EntityDefinition and other similar "text" fields that also have relationship information now show up in Jetstream is normal related objects that you can traverse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants