-
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
Salesforce Formula Practice Questions | The Ultimate Guide
Certainly, here’s a list of practice questions involving Salesforce formulas that cover various aspects and use cases: Create a formula field called Total_Revenue__c on the Opportunity object…
Highlights of Salesforce and Alibaba collaboration
Salesforce and Alibaba Cloud have confirmed that they are working on a deal to build Salesforce Social Commerce, a headless commerce platform that will be…
Publishing an App on Salesforce AppExchange
Introduction There are three major steps to be followed to get your App on Salesforce AppExchange. Plan ( what type of App you want to…
Popular Salesforce Videos
Salesforce Admin Certification 2020 Questions Explained with References - Part I
How to prepare and pass Salesforce Admin Certification with Practice Exam Questions 2020 practice questions and answers for the Salesforce Administration Salesforce Certified Admin Exam…
How to Use Dispatcher Console in Salesforce Field Service? | Elevate Field Service Delivery | AblyPro
Dispatcher Console makes field service delivery easy for your business. Using the Dispatcher Console included in the Field Service package, your dispatchers can easily schedule,…
Gantt Charts in Salesforce Lightning | Salesforce Tutorials
In this video, you will learn to implement the Gantt Chart in your Salesforce org. We will use Google Gantt Chart scripts and we will…
Popular Salesforce Infographics
See Why Salesforce Goes All In on Pro Bono
Salesforce Pro Bono Program aims to match nonprofits and higher education institutions with Salesforce professionals to maximize their Salesforce implementation and transform their organization. Scroll…
Salesforce Dreamforce: A History of Innovation
Salesforce is anything but your average technology company. From its 1-1-1 philanthropic model to the scrappy startup culture, Salesforce defies traditional logic for how a…
Automation Tools In Salesforce
Automation tools in Salesforce can eliminate monotonous tasks, freeing up an admin’s time to do more profound things. These tools include Workflow Rules, Process Builder,…