-
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
What Is Vlocity in Salesforce? Key Features and Business Applications
Founded in 2014, Vlocity rapidly established itself as a pioneer in the "industry cloud" space, earning three consecutive Forbes Cloud 100 awards in 2017, 2018, and 2019.…
Algoworks Is Glad To Announce Partnership With WebMerge
A. Introduction To WebMerge Webmerge is an online platform that gives the ability to collect data easily, allowing to populate a document, and sending it…
Top Reasons to Attend Dreamforce 2024
Table of Contents Top Reasons to Attend Dreamforce 2024 Cutting-Edge Keynotes and Sessions Learn the Hows and Whys of Trusted AI Be on the…
Popular Salesforce Videos
Tips to Crack the Salesforce Administrator Certification Exam in One Go
Do you want to become Salesforce administrator certified? So in this video Shrey has shared the important topics to crack the Salesforce Administrator Exam. Following…
Non-technical But Want to Build Career in Salesforce?
In this video Shrey gave the answer to the following questions: 1. What is the next step after doing Certification in Salesforce Administrator? 2. How…
Salesforce Service Cloud Implementation
Salesforce Service Cloud offers a long list of powerful tools to help you realize the potential of your service team. With the endless opportunities for…
Popular Salesforce Infographics
Top Salesforce Trends For 2023
When it comes to managing customer databases, Salesforce is leading the pack. Companies are increasingly relying on this powerful tool for its unrivalled flexibility and…
Salesforce Operations/Demographics
Salesforce, the world’s No. 1 CRM Company, has significantly changed the way how business software is delivered and used. Salesforce has found the perfect way…
Benefits of Salesforce Pardot Implementation
Cyntexa offers the best Salesforce Pardot Implementation services so that you can offer the best customer services. Our certified experts will provide Salesforce Pardot Implementation…