-
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 Governance: The CRM Health Long-Term Creation of Salesforce Consulting Services
Hey there! You probably know that Salesforce is an amazing platform for doing business– it is a growth engine. However, there is a problem with…
OAuth 2.0 Client Credentials Flow | Salesforce Developer Guide
OAuth 2.0 has a flow called Client Credentials that is useful when there are requests to APIs that don't involve the user. The client credentials…
Why Integrate SAP with Salesforce in 2024?
While SAP-Salesforce integration can improve operations and data flows, it can also present challenges such as data silos and duplicate data entry. This guide, written…
Popular Salesforce Videos
Salesforce Workbench | Salesforce Tutorial Video
In this video, we show you how to use Salesforce Workbench to set a user password. This can be useful when you have a user…
Salesforce Integration Using Oracle SOA Suite
In this video, Bristlecone gives an introduction to Oracle Cloud Adapter for Salesforce.com. Afterwards, he goes into detail about how to integrate Salesforce.com using Oracle…
How to Deliver Great Customer Service With a Small Team [Salesforce Webinar]
Overwhelmed by a backlog of customer service requests? And worried your team is too small to handle all the requests? Then, this video is for…
Popular Salesforce Infographics
Top Benefits of Integrating Salesforce and NetSuite
Salesforce, on the one hand, is the world’s number cloud-based CRM. NetSuite, on the other hand, is one of the best ERP systems. And when…
How To Upgrade Your Business With Salesforce?
Salesforce has been stretching the possibilities of business growth right from its inception in 1999. Its fierce business model attracted people who eventually moved to…
Salesforce - Key For Your Industry Solutions
Salesforce endlessly improves the productivity and performance of the company. To enhance the customer experience and generate more revenue many industries will be opting for…