-
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
Top Sales Challenges in 2023 Which Salesforce Sales Cloud Can Solve
There’s no denying the fact that a sales job is full of challenges. Sales managers are constantly on the lookout for ways to optimize their…
Demystifying Salesforce Blockchain
Salesforce is always a company that is looking ahead to the next big in technology, whether it is mobile, social, IoT or Artificial Intelligence. The…
Marketing Cloud Account Engagement (Pardot) Use Cases
Use Case 1: Engagement Program in Pardot Problem Statement The client had a process of booking training courses, which implied the interaction between Pardot and…
Popular Salesforce Videos
8 Steps to Become a Salesforce Developer!
Do you aspire to become a Salesforce developer? Are you stuck on what next steps you need to take to become a developer? Check out…
5 Salesforce Hacks to Boost Your Business Sales
Good sales help you to get qualified leads and customers who bring value to you as well. Hence it becomes imperative to have astute resources…
Salesforce Integration | GET Method - Part 2 | Salesforce
Salesforce integration is the process of merging the data and functionality of Salesforce with another application to provide users with a single unified experience. It…
Popular Salesforce Infographics
Enable Ideas Management in Salesforce LEX to Drive Innovation
Leveraging and managing ideas on your Salesforce-powered communities can lead to business growth, improved product quality, and stellar customer experience. Not only does the Ideas…
How Low-Code App Development Enables Business Agility in Times of Change | Salesforce
Businesses in today's fast-changing, the digital-first world must adapt to change and meet customer demands in innovative ways. They have to quickly digitize to make…
Salesforce Solutions For Travel Agencies
Salesforce for Travel is more than just a CRM. It’s a comprehensive ecosystem designed to empower travel agencies of all sizes. Comprehensive solutions offered by…