TransWikia.com

Createdby cannot reference custom field?

Salesforce Asked by Shuo Wang on December 22, 2021

I am struggling with the createdby reference and hope someone could help me out. I have a custom object and as everyone knows there is a standard createdbyId created on every custom object. We can use Createdby.Name to get the the name of the creator. I have created a custom picklist field Type__c on standard user object and want to use Createdby.Type__c to get the user type info.However I got the error
“No such column ‘Type__c’ on entity ‘Name’. If you are attempting to use a custom field, be sure to append the ‘__c’ after the custom field name. Please reference your WSDL or the describe call for the appropriate names.”

Select id,createdby.username,createdby.id,createdby.email,createdby.IsActive,CreatedById,Createdby.Type__c from sampleobject__c

Is this possible to reference custom field on standard user object using createdby?

Thany you.

2 Answers

this is most likely a known issue that should've been solved in SF Summer '15 release (https://help.salesforce.com/articleView?id=000339711&mode=1&sfdcIFrameOrigin=null&type=1)

Try upgrading your apex class version to the laets

Answered by stuckKnowledge on December 22, 2021

Custom Field on User object can be accessed in SOQL like standard fields. In your case check make the field is visible to the user. (Customize > Users > Fields > Type(or whichever custom field is created) Click on button > 'Set Field Level Security' Make it visible to your profile.

That's it.

Answered by Ishwar Mete on December 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP