-
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
Sneak Peek: Latest Features And Updates of Salesforce commerce Cloud
With rising customer expectations in a tech-savvy marketplace, it has become critical for retailers to deliver top-shelf shopping experiences to stay relevant and competitive in…
Useful Salesforce Steps and Instructions – Part 4
Hello All, Welcome to the another part of Useful Salesforce Steps and Instructions. The provided below steps will be very useful for you while working…
How Does Salesforce Marketing Cloud Solve the Marketing Issues of Small Businesses?
With time customer demands are growing, and it becomes an issue for the marketer to maintain the product's branding. This is particularly true for small-scale…
Popular Salesforce Videos
Sculptor CPQ for Salesforce
Sculptor CPQ (Configure-Price-Quote) for Salesforce CRM-based businesses allows to reduce the length of the sales cycle and generate quotes 2X faster. Smart and intuitive product…
See how fast and easy you can make intuitive Salesforce solutions to your users with Cauzali.
Instead of coding or very complex flows use Cauzali. Place your Cauzali model everywhere in Salesforce including in the middle of a Flow. Price between…
Salesforce Work.com New Features
Work.com includes new solutions to accelerate the private and public sector's answer to the COVID-19 pandemic, ranging from contact tracing and emergency response management to…
Popular Salesforce Infographics
What are the Top 5 Affordable Salesforce Integration Apps for SMBs?
Salesforce CRM is one of the core tools for any business looking to build B2B and B2C leads – and while the CRM itself is…
How Salesforce Einstein Can Improve Sales?
Customer Relationship Management has provided businesses with seamless means, marketing strategies and activities to help improve sales. The thing about traditional CRM is that it…
Salesforce IoT Cloud System - Connect With Your Customers Proactively
The Salesforce IoT Cloud is a platform for storing and processing IoT data. It uses the Thunder engine for scalable, real-time event processing. Its collection…