-
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
Enable Skype for Salesforce | The Developer Guide
We all are very much familiar with Skype, here I am going to tell you about how skype can be used for Salesforce, coordinates Salesforce…
Salesforce Einstein: An Overview
Salesforce Einstein is a very important feature of Salesforce CRM that uses artificial intelligence tools. Artificial Intelligence is a part of machine learning, it helps…
What Does Salesforce Administrator Mean in 2023?
A Salesforce administrator is a professional who is responsible for managing and maintaining a Salesforce implementation. They are responsible for the configuration, customizations, and upkeep…
Popular Salesforce Videos
MailChimp Salesforce Integration
The MailChimp and Salesforce integration allow you to start creating email campaigns from the leads and contacts in your Salesforce CRM. With the integration, it becomes easy to create list segmentation…
Salesforce Editions Explained
In this video, we break down the Salesforce Editions—Essentials, Professional, Enterprise, and Unlimited—to help you understand which one is best for your business. Whether you're…
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…
What is Salesforce Customer 360?
According to our State of the Connected Customer report, 76% of customers expect consistent interactions across departments. However, 54% say it often feels like sales, service,…
Features of Salesforce Spring’ 23 Release That Must Not Miss
The new updates in the Salesforce ecosystem will bolster the marketing power of the businesses. Companies are now more effectively building their marketing strategies which…