+ Start a Discussion

How to Get Created Record Id & show that record in Visualforce page?



I created a new lead record via visual workflow and I binded that visual workflow into visualforce page.


Its working fine. But I need a latest created Lead record on visualforce page once I click the finish button on visual workflow.


I tried with finishlocation but its not working. Its just to move the home page only.


How to get that lead Id on visualforce page and redirect to the lead record?




I just posted the code to do this. Hope it helps!


Hi rajaram,


Please share the code...


Hi Rajaram,


In that specific code, you used the ".vaLeadID" variable.


But in my case I fetch some values using visual workflow and create the Lead using visual workflow ---> Record create


In that there is no leadId values. Via visual workflow I am not getting LeadId values


 Plese help me. How to get the lead Id in visual workflow and given to vf??




When you create the lead in VWF, you have the option to store the ID into a variable. If  you are using the desktop designer, go to the "Assign ID" tab and select the variable. If you are using the cloud designer, just pick the variable to store the value inthe bottom section of theoverlay


I was able to use your sample code successfully to get the ID and generate the finishLocation URL properly; however, I'm getting an "Authorization Required" error from the Site. I've verified that the Apex Controller has been enabled access under Public Access Settings and the custom object being displayed is enabled as well. Is there anything else I should be adding?