-
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 Data Loader Guide - Here's All You Need to Know
Data Loader It is a Client Application used for importing and exporting bulk data. Using it we can Insert, Delete, Update, Upsert, and export the…
Salesforce Developer Job Opportunities in 2024
Salesforce Developers are in huge demand due to the rapid growth of Salesforce worldwide. Based on a research by IDC, the number of employment requisition…
Building Dynamic User Experiences with Salesforce Lightning Beyond Static Screens
Gone are the days of one-size-fits-all Salesforce interfaces. Today's users demand personalized, dynamic experiences that cater to their unique roles, needs, and preferences. Salesforce Lightning…
Popular Salesforce Videos
How to Get a Job in Salesforce as a Fresher | Video Guide
Looking to start a career in Salesforce. Wondering how to get a job in Salesforce as a fresher. Check out this video it will guide…
How To Use Journey Builder In Salesforce Marketing Cloud | Salesforce Tutorial
How to use Journey Builder in Marketing Cloud. This video will cover the following points - 1. Introduction Get a brief introduction to Journey Builder…
Driving Gamified Interactions on Salesforce Communities With ScoreNotch | Use-Cases
A Salesforce-native, Lightning-ready solution, ScoreNotch enables you to dynamically gamify Salesforce communities. Watch this video to learn more about its use-cases. For more, please visit…
Popular Salesforce Infographics
Average Salesforce Salaries in 2023-2024: What You Need to Know
Salesforce is a popular CRM platform that is used by businesses of all sizes. If you're considering a career in Salesforce, you may be wondering…
10 Common Salesforce Mistakes—and How to Avoid Them
Salesforce integration is challenging if you don’t know exactly what you’re getting into. It’s an enormously valuable project, but diving into it without proper understanding…
Salesforce Buzz | An Infographic
While Salesforce has been coined as the World's #1 CRM, there has been a constant buzz around the stats and facts of it. Almost 58%…