-
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

Introduction on Salesforce and HIPAA Compliance
HIPAA stands for ‘The Health Insurance Portability and Accountability. As per HIPAA, it was established in the year 1996 that all the data related to…

How AI Will Improve CRM in 2019
Customer relationship management (CRM) is one of the fields that stands to benefit the most from the rapid development of artificial intelligence (AI) in 2019.…
Popular Salesforce Videos
Salesforce Certification Training | Salesforce Training Videos for Beginners
This Salesforce Administrator & App Builder certification Training course is designed to ensure that you learn & master the concepts of Salesforce Administrator & App…
Introduction to Salesforce Marketing Cloud
Hello Everyone, In this video, by Amit Singh, we will talk about the basic introduction of the Marketing Cloud in Salesforce. Watch the video and…
Deploy Lightning Web Component Files | Salesforce Lightning Tutorial
Learning Objectives After watching this video, you’ll be able to: Configure Lightning web component files for display in an org. Deploy your files to an…
Popular Salesforce Infographics

Why Do Business Move To Salesforce?
Salesforce Improves Customer Data Quality & Management – One of the core functions of all CRMs is data management about customers. Salesforce delivers in this…

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…

How to Deliver a Great Presentation at Dreamforce? [Infographic]
First of all, remember that attendees have paid good money to see you — so it's up to you to make sure they get what…