-
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 Administration Services: Why Every Business Needs Them in Today's Competitive Landscape
In today's fast-paced and highly competitive business landscape, companies are constantly seeking ways to streamline their operations, improve customer engagement, and drive revenue growth. Salesforce,…
Pardot vs Marketing Cloud: Which Tool Is The Ultimate Game Changer?
Here’s a question: Which Salesforce marketing automation tool is the right choice for your business? Is it that easy to answer? We bet you, it…
What Are The Benefits of Implementing Salesforce and eCommerce Integration?
Technology has evolved the way we shop online. Online retailers are optimizing multiple channels to attach with their patrons. Online marketplaces, eCommerce websites, social media,…
Popular Salesforce Videos
Pass Record Id into Flow from Record | Salesforce Tutorial
Passing record ids is a technique that every flow master needs to know to use flows to their full potential. In this video, we go…
How to Set Up Salesforce Knowledge?
Watch this video to learn how to set up Salesforce Knowledge so you can help your team more easily find answers to common customer requests.…
What is External ID and Why it is used in Salesforce?
This video has been divided into following points: What is an External ID in Salesforce? What is the use of External ID in Salesforce? How…
Popular Salesforce Infographics
New Pardot Features: What was delivered in Summer ’18
New Pardot features, summer '18. Pardot has treated us to many enhancements across the core tool and related products. This infographic gives you an overview…
Unlock the Potential of Financial Services with Future Trends | Salesforce
The financial services industry is being transformed by emerging technologies like AI, Low-Code, No-Code Solutions, Adoption of the cloud. Discover the various future and trending…
5 Advantages of Using Salesforce for Your Business
Salesforce is a customer relationship management (CRM) platform that offers a wide range of features and benefits for businesses of all sizes. Here are five…