-
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
From Discovery to Design: Creating Seamless User Experiences in Salesforce
Introduction User experience (UX) plays a major role when implementing Salesforce, as it has a significant impact on user satisfaction and adoption rate which, in…
Maximize Revenue: Hire Salesforce Sales Cloud Developer Team
In the modern competitive landscape, a CRM is no longer just a database; it is the engine that drives your entire sales pipeline. To transform…
Lightning Design Experience In Visualforce Pages with Lightning CSS Framework
Salesforce Lighting Design System(SLDS) is a CSS framework introduced by Salesforce to create faster,responsive and beautiful pages even in Salesforce Classic. This css framework is…
Popular Salesforce Videos
Create Targeted Campaigns w/ Marketing Cloud Advertising | Salesforce Demo
Explore the power of using 1st party data to power ad audiences across the most popular ad channels today, including Google (Search, Shopping, YouTube, Gmail),…
Rollup Trigger via Salesforce Record Triggered Flow - Trigger without code
Hello Folks, I created a Rollup trigger via Salesforce Record Triggered Flow (without code cool isn't). I use Record trigger Flow for that scenario. There…
Relationships in Salesforce | Why Relationships are Created?
In this video, Salesforce Rangers goes into detail about what relationships are in Salesforce and why they are necessary in the first place. This is…
Popular Salesforce Infographics
Project Management Tools: Native on The Salesforce Platform
Finding the right solution that can help you use Salesforce for project management can be challenging. Integrating your project management with Salesforce helps you to…
How a CRM Platform can Immediately Impact your Business
Selecting the best CRM for small businesses is not a one-size-fits-all endeavor. If you’re new to working with a CRM platform, you often have to…
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…