You need to sign in to do that
Don't have an account?
Alan Ziegler
Newbie retrieving Lead record using name passed in URL
I am a newbie so any advice is most welcome as my whole approach may be wrong. For a new web guest where I don't yet want to require the guest to reveal name and contact information, I have a page that creates a unique ID, saves this as a cookie, and uses web-to-lead to create a new Lead record with this name and his interests from a form multi-select list. This all seems to work. When this lead comes back in a new session, this page sees that he has a unique ID in cookie and assigns a new visualforce page with a URL parameter containing the existing unique ID. The new page attempts to look up his Lead record interests using a controller extension with a select statement. I have looked through many examples online of how to code the controller (some of which gave me syntax errors) and picked what seems like the simplest example for a template that "compiles". From the start, the controller query is returning nothing. So I have simplified the controller query to only try to find the first lead record to return and this also returns nothing. My controller extension code is:
public class LeadNameLookupTest
{
public LeadNameLookupTest(ApexPages.StandardController controller) {}
private Lead guest;
public LeadNameLookupTest()
{
guest = [select ID, name from Lead limit 1];
}
public Lead getLeadRecord()
{
return guest;
}
}
The visualforce page below third alert does display the unqiue ID being passed via URL but the earlier alerts display nothing in alert popup. The page code is:
<apex:page standardController="Lead" extensions="LeadNameLookupTest">
<script>
alert({!LeadRecord.ID});
alert({!LeadRecord.name});
var guest_name = "{!$CurrentPage.parameters.guest}";
alert(guest_name);
</script>
</apex:page>
Maybe the controller example I used is flawed. I did see other more complicated templates. I even tried some of these more complicated examples but they would not "compile" or the page script reference to controller result failed. Or maybe my alerts are a problem.
public class LeadNameLookupTest
{
public LeadNameLookupTest(ApexPages.StandardController controller) {}
private Lead guest;
public LeadNameLookupTest()
{
guest = [select ID, name from Lead limit 1];
}
public Lead getLeadRecord()
{
return guest;
}
}
The visualforce page below third alert does display the unqiue ID being passed via URL but the earlier alerts display nothing in alert popup. The page code is:
<apex:page standardController="Lead" extensions="LeadNameLookupTest">
<script>
alert({!LeadRecord.ID});
alert({!LeadRecord.name});
var guest_name = "{!$CurrentPage.parameters.guest}";
alert(guest_name);
</script>
</apex:page>
Maybe the controller example I used is flawed. I did see other more complicated templates. I even tried some of these more complicated examples but they would not "compile" or the page script reference to controller result failed. Or maybe my alerts are a problem.
All Answers
Can you please share with me your complete issues & your requirement.
Regards,
Scott Haleo
Hytechpro