You need to sign in to do that
Don't have an account?
b-Force
Calling Javascript after user select Record from Standard Lookup Search window
My requirement is as follow
I have a Visual force page with some input fields
It has a lookup field
When user click on Search icon ------Standard Search popup opened -------- User select some record
and return back to original page
when it returns to original page I want to retrive some data from selected master record and populate on the page
Please help me how to catch this event in javascript or apex....
code is as follow
<apex:pageBlockSection id="GeneralInfo" columns="1" showHeader="true" title="General Information for Claims"> <apex:inputField Value="{!Claim__c.Name}"/> <apex:inputField Value="{!Claim__c.Description__c}"/> <apex:inputField Value="{!Claim__c.RequestedAmount__c}"/> <apex:inputField Value="{!Claim__c.Fund_Request__c}" onchange="changed()" onselect="selected()" onmouseout="mouseout()" onblur="alert('onblurred');"/> </apex:pageBlockSection>
If we capture this event, then We can populate fields using ajax :)
Thanks in advance,
Bala
I resolve my bussiness problem using Javascript
I follow following steps to
1) On Window load initiate a function which fires periodically and checks whether Any record from look is seleceted (It check for every 2 seconds)
2)then get Id of selected record, Retrive record using SOQL in Ajax
and populate on the page
It works fine
Thanks,
Bala
All Answers
Bala You will have to use JavaScript to resolve this issue to capture the information from the record that is selected. I am confused on what data exactly you need to retrieve and how do you plan to use it.
I understand you have a custom VF Page that has a lookup field.
When a user selects the record for the Lookup field you want to get some other information, Correct?
I think it would be helpful to:
a) Explain more clearly with the actual business case that you are trying to resolve?
b) If possible put your entire code for others to understand the issue in its entirety.
One tip I would give is that there are two hidden elements that you can access on a custom VF Page for a lookup field using document.GetElementbyID function.
The first element is a hidden element that is set when a record is selected by the User. this element is setting the record ID. The second element sets the record name which is displayed on the lookup page.
There are also other Elements such as lk_old(XXXXXX), lk_new etc which stores historical values.
These element IDs are constant and hence can be used to do some major customization.
Here is an example that I had developed when I was working with one of my clients. On a Contact Page there is a Lookup field for Primary Office, Hence if the Primary Office (Custom Object) was not selected than it will pop-up the a custom VF Page which will then be populated by the user to create a custom office.
I passed the Contact ID, and the Company Name selected on the contact record to that custom VF Page by appending those parameters to the URL and retrieving them by split method. I will be happy to share my code if that is needed.
Thanks you so much for your reply :smileyhappy:
Bala
I resolve my bussiness problem using Javascript
I follow following steps to
1) On Window load initiate a function which fires periodically and checks whether Any record from look is seleceted (It check for every 2 seconds)
2)then get Id of selected record, Retrive record using SOQL in Ajax
and populate on the page
It works fine
Thanks,
Bala
I am glad that worked out for you.