Explore Courses Blog Tutorials Interview Questions
0 votes
in Salesforce by (11.9k points)
I simply want to display an input field, that will let me capture a user, so I can filter a list from a custom object by the owner. CustomObject__c.OwnerId is not writable, so when I bind it to an input field, nothing is displayed on my page! I don't want to have a drop-down list of users (There could be hundreds!) and I don't want to create a spurious custom object with a writeable field, related to the User object. How can I get the input field functionality for a read-only field, as if it were writeable?

1 Answer

0 votes
by (32.1k points)
edited by

In order to display an input field for Users, in a visualforce page, OwnerId field should be writeable. Unless your field security permissions are messed up or for example, the field is hidden because it's a detail in Master-Detail relationship.

But when you'll manage to get it to work you'll see that most likely it's a bit weird lookup that can point to User or Queue.

Case Owner lookup field

If you're fine with that - great, just check the security around the field. If you need really only a lookup to a user - check if you have any custom Lookup(User) field? You could create a dummy record of that type in the controller and don't do any DML with it, just use the fact it'll have the lookup.

If you don't have any custom ones - I think that Account / Contact / Opportunity owner must be a user (can't have queues). You might have to force <apex:input field... required="false"/> but other than that it should OK?

Want to learn Salesforce in depth? Go through the Salesforce Training provided by Intellipaat!

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.4k questions

32.5k answers


108k users

Browse Categories