-
How to pass Lookup field input value from VF page to controller to be passed to another page in Salesforce?
I have a requirement to use contact to create a new case. I have created a new page using case.contactID input field. On pressing a command button, the contact selected should be passed to new VF page so that that can be used to create a New case. But I am currently stuck passing the selected value even to the controller(Null is passed). I am new to VF and Apex. Please advise how to do it, then I will need to pass the value to anther page. Below are my Apex class And VF code.
VF Page Code:
--> -->
</apex:pageBlockSection>
<apex:commandButton value=" Add New Contact " action="{!callcasetabnewcon}"/>
</apex:pageBlock>
</apex:form>
Controller Code: public class Create_case { public case c {get;set;} public id conselected {get;set;} public contact con{get;set;} public string conId {get;set;}public Create_case () {
case c= new case();
}public PageReference callcasetabsearch() {
system.debug('Button method called');
Id conID= conselected;
contact con= new contact();
if(conID!= null) {
con=[Select firstname from contact where id=:conID];
}
system.debug('value of contact id is:'+ conID);
//if(c.ContactId != null) {//con=[Select firstname from contact where id=:c.ContactId];
//strText= con.firstname;
//pageReference pr = Page.assign_1_Case_search;
// pr.getParameters().put('str', strText);
//pr.getParameters().put('msg','success');
//pr.setRedirect(false);
//return pr;
//}
//else
return null;}
Log In to reply.
Popular Salesforce Blogs
FileMaker, Salesforce Integration - Get the Best of Both the Worlds
First things first, why do we need the integration at all? Direct integration between FileMaker and Salesforce allows developers to use the best capabilities of…
Why all Salesforce Users Should Integrate Their Systems
A common scenario with organizations using Salesforce is having a scenario where employees from different departments, are not able to access the same accurate, real-time…
Integrating Google Maps with Salesforce - All You Need to Know About
In this blog, we learned how to use the MARKER API to integrate Google Maps with the Salesforce. An area on a map is designated…
Popular Salesforce Videos
Write Tableau CRM Data to Salesforce Objects
Use Tableau to blend Salesforce data from across the Customer 360 platform with your other business data for increased visibility and a deeper understanding of…
Salesforce Video Wall
Salesforce approached Obscura with the opportunity to create imaginative media for the 107’ long LED video wall in the lobby of their flagship San Francisco…
Salesforce Administrator and Developer Training | Salesforce Training Videos
This Salesforce Training video is a demo of how the live online instructor-led classes take place after you enroll for the Online Classroom. All training…
Popular Salesforce Infographics
Salesforce Field Service: Power Up Your Field Operations
Salesforce Field Service, commonly known as Field Service Lightning (FSL), is the extension of Service Cloud that provides a unified view of workforce management. In…
5 Security Habits That Help Your Salesforce Admin Career
As Salesforce Admins, you drive results and deliver business value every day. You automate processes and make them more efficient. You can also learn more…
How do People Spend Time on Salesforce?
The average salesperson spends 4 hours per week updating his or her Salesforce CRM. However, this is hardly enough—the average salesperson only manages to complete…