-
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
Coding and Scripting: Key Differences and Modern Uses
In the fast-paced world of the present times, scripting and coding are the foundations on which this computer era functions. From day-to-day applications to websites…
Salesforce Dynamic Actions: How to Get Started?
The Salesforce Spring '23 Release date is approaching. And there is one (of many) interesting features in Release Notes: Dynamic Actions for Standard Objects (Generally Available).…
Revolutionizing Patient Care with Salesforce Healthcare Cloud
Introduction Technology is the riveting force behind changing health care in the modern world today. Salesforce Healthcare Cloud stands at the forefront of this revolution…
Popular Salesforce Videos
MuleSoft Integration: GoToWebinar to Salesforce - Learn Salesforce Series
In this video, you will learn how to use MuleSoft integration platform to transfer attendees data from GoToWebinar to Salesforce- 1. Set up GoToWebinar account,…
COVID-19 Impact on The Automotive Industry -Digitization With Salesforce Can be a Solution
Coronavirus is expected to create a physical contactless environment with an increased thrust on online assessment and buying of vehicles. This is a huge shift…
How to Become Salesforce Certified Architect: Achieve More Under Pressure
Achieve more under pressure: CTA Edition How to become Salesforce Certified Architect 0:00 Introduction 5:21 What is CTA exam about 10:37 What is CTA Exam…
Popular Salesforce Infographics
What is a CRM System?
Customer relationship management (CRM) is a technology for managing all your company's relationships and interactions with customers and potential customers. The goal is simple: Improve…
What to expect with a Salesforce project?
It is important to note that one person can fulfill more than one role (typically in smaller projects) but these roles do need to be…
How to start your career In Salesforce?
Considering a career in Salesforce is a good choice for IT professionals looking to give a new boost to their career. Salesforce is a new…