-
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

How Salesforce is Supercharging Customer Experience in Financial Services Businesses
Breakthroughs in new-age technologies and changing expectations of digital-savvy customers are the main contributors to the ongoing revolutionary change in the financial services industry. Be…

Ultimate Guide to Choosing the Right Salesforce Consultant for Your Team
When it comes to leveraging the power of Salesforce to boost your business operations, the role of a skilled Salesforce consultant cannot be overstated. Salesforce,…

Benefits of Salesforce Implementation for Healthcare
Are you planning to implement Salesforce or still wondering if it will make sense to have expert Salesforce implementation services for healthcare? With an aim…
Popular Salesforce Videos
Simplify Salesforce Development using CLI and VSCode Tasks
The Salesforce CLI is a powerful command-line interface that simplifies development and builds automation when working with your Salesforce org. Typing commands can be monotonous…
Salesforce Acquires Slack
When Salesforce bought Slack earlier this week for $27.7 billion, it was in some ways the end of a startup fairytale. Slack was the living…
Introduction to Salesforce and Data Modeling | Quick Start | Episode 1
In this video, you will get started with Salesforce Development and build Salesforce Applications without writing code. Watch this video and learn. 00:00:00 - Start…
Popular Salesforce Infographics

How Your Business Can Leverage The Power of Salesforce Community Cloud?
Community Cloud is a cloud-based platform that enables businesses (small, medium, big) to build exceptional and interactive CRM-powered portals, forums, and sites that are faster…

Impact of Salesforce
Salesforce is no doubt is one of the boldest CRM on the cloud in the world. This infographic helps you scan through all the vital…

Salesforce – The Future of Digital Transformation | An Infographic
Salesforce has been coined as the world’s top CRM company and customer company. It has been soaring high in the clouds, so let’s brush through…