You need to sign in to do that
Don't have an account?

Look up field on VF Page
Hi,
I have a look up field on visual force page. Need a look up to user. So querying contact by logged in user and making use of contact.reportsId as the value of input field. This is bringing up the look up field to user and wanted the input field before the glass icon to be disabled. so I did this way.
For example: if I pick Priyanka Pallepati as the user by clicking the glass icon of look up field, I want to send Priyanka Pallepati to my doSave method.
How do I achieve this? Any suggestions would be highly appreciated.
Regards,
Priyanka.
I have a look up field on visual force page. Need a look up to user. So querying contact by logged in user and making use of contact.reportsId as the value of input field. This is bringing up the look up field to user and wanted the input field before the glass icon to be disabled. so I did this way.
- <apex:inputField id="requestor" value="{!contact.ReportsToId}" html-disabled="true">
- <apex:commandButton value="Submit" action="{!doSave}"/>
For example: if I pick Priyanka Pallepati as the user by clicking the glass icon of look up field, I want to send Priyanka Pallepati to my doSave method.
How do I achieve this? Any suggestions would be highly appreciated.
Regards,
Priyanka.
This is impossible, in the con.ReportsToId, you must be getting a contact Id and if you query on contact with that id, it must return the record. Check my code, in the where clause I am comparing and I think your query is like the later will not return any record, beacuse as you checked all the contacts in your org have reportsToId as null. If you still faces the issue, either provide me your org credentials or contact me on my email Id: neetu.bansal.5@gmail.com
Thanks,
Neetu
All Answers
As you have binded the look up with the contact.ReportsToId, so in your doSave method, use it directly, as it is binded already with the controller and you don't need to pass it to controller. Like: If it doesn't help, paste the code of your page and class.
If this post helps you, mark it as best answer, so will help others in future.
Thanks,
Neetu
I got the reportsToId in my controller.. But if I query contact by its reportsToId I get no returned contacts. I queried in salesforce schema, all the contacts in org dont have reportsToId.
All I need is a look up to Contact and when they pick a contact I should be able to query the contact by the value.
Can you help?
Thanks,
Priyanka
So your requirement is there is a look up of contact, as the user picks the contact, you want to query that contact. is it?
If yes, then while querying, search in contact id, not in reportsToId, as you want to search all contact like:
If it still doesn't help, paste the code of your page and class.
If this post helps you, mark it as best answer, so will help others in future.
Thanks,
Neetu
This is the same thing I tried. But I can't seem to query contact by its reportsToId.. list is coming as zero; I even went ahead and looked at eclipse salesforce schema queried all reportsToId for existing contact.. they seem empty..
thanks,
priyanka.
This is impossible, in the con.ReportsToId, you must be getting a contact Id and if you query on contact with that id, it must return the record. Check my code, in the where clause I am comparing and I think your query is like the later will not return any record, beacuse as you checked all the contacts in your org have reportsToId as null. If you still faces the issue, either provide me your org credentials or contact me on my email Id: neetu.bansal.5@gmail.com
Thanks,
Neetu