You need to sign in to do that
Don't have an account?
ian elrick
REST API and SOQL How to retrieve the Displayed "Created By" instead of the createdByID
Hi
I have successfully got a rest call working with bbbbasic fields from the opportunity table as follows:
SELECT Opportunity.Name, OrderNumber__c,Account.Name, Type,StageName, Description,CloseDate from Opportunity where IsClosed = False order by CloseDate ASC LIMIT 100
I want to add other fields to this such as "Created By" but these are lookups on the User table and including the CreatedById field gives the id as opposed to the meaningfull date.
Any idea how to do this?
Thanks in advance.
I have successfully got a rest call working with bbbbasic fields from the opportunity table as follows:
SELECT Opportunity.Name, OrderNumber__c,Account.Name, Type,StageName, Description,CloseDate from Opportunity where IsClosed = False order by CloseDate ASC LIMIT 100
I want to add other fields to this such as "Created By" but these are lookups on the User table and including the CreatedById field gives the id as opposed to the meaningfull date.
Any idea how to do this?
Thanks in advance.
Please use createdby.Name to get the full name of the user who created Opportunity.
Thanks
Thanks for this. That is helpful . One more ask? Can you direct me to where the rules for such access are documented?
I take it to get the displayed value of any lookup column I just retrieve the .Name of the label without spaces?
Thanks again
CreatedBy and Lastmodifiedby are lookup of User object. And in queries, you can refer all the fields of user object using its reference createdby.(user field)
You can check lookup fields on your object and accordingly use its reference fields.
Please check the reference links mentioned below:
Lookup field reference: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_lookup.htm
System fields reference: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/system_fields.htm
Please mark the answer as best if it helps you resolve your queries.
Thanks.
Thanks. That is superb. I cannot see an option to mark as best. Just to like. Can you advise how to do this please?
Thanks.