API Names in Salesforce
In Salesforce, an API Name is a unique identifier for metadata components like fields, objects, or custom settings that enables external systems, scripts, and integrations to reference Salesforce data programmatically. The API name remains consistent, even if the label displayed in the user interface changes, making it essential for maintaining integration stability.
Key Characteristics of API Names
Field and Object API Names:
- Standard object and field API names generally mirror their label names, but with spaces removed.
- Custom fields and objects have the suffix
__c, denoting them as custom.- Example: A custom object called "Project" would have an API name of
Project__c. - A custom field called "Start Date" on the Project object would have an API name of
Start_Date__c.
- Example: A custom object called "Project" would have an API name of
Case-Sensitivity:
- API names in Salesforce are case-sensitive, so it’s essential to match them exactly when using them in code or integrations.
Usage:
- API names are used in SOQL queries, Apex code, integration tools (like REST/SOAP APIs), custom formulas, reports, and any other context where data needs to be programmatically accessed.
Examples of Common API Names:
- Standard Field:
Account.Name(for the Name field on the Account object) - Custom Field:
Project__c.Start_Date__c - Standard Object:
Contact,Opportunity - Custom Object:
Project__c,Expense__c
- Standard Field:
Example Usage in SOQL
If you wanted to query a custom field Start_Date__c on a custom object Project__c, your SOQL query would look like this:
Knowing the correct API names is essential for ensuring your SOQL queries, Apex code, and integrations work accurately in Salesforce. Let me know if you’d like to see more examples with API names in specific contexts!
Comments
Post a Comment