Salesforce EntityParticle

Entity Particle 

Represents each element of a field that can be presented in a user interface. Contrast EntityParticle with FieldDefinition, which represents each element of a field defined in the Metadata API. EntityParticle has parity with describe, which returns API-accessible fields only for an entity.

EntityParticle

Let's say there is a requirement to fetch all picklist fields along their label, API Name.

SOQL query using Entity Particle 

SELECT EntityParticle.DeveloperName, Label, Value, IsActive, EntityParticle.IsDependentPicklist, EntityParticle.FieldDefinition.ControllingFieldDefinition.DeveloperName
FROM  PicklistValueInfo 
WHERE EntityParticle.EntityDefinition.QualifiedApiName = 'Case' 
AND EntityParticle.IsDependentPicklist = TRUE 
ORDER BY EntityParticleId, Label

Results





















Retrieve all the fields of the 'Phone' data type




Comments

Popular posts from this blog

Introduction to Salesforce Agent Script: Build Predictable AI Agents

Anti-Patterns in Salesforce Agentforce: What to Avoid When Building AI Agents

MCP vs. Traditional APIs: Choosing the Right Integration Approach