-
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

Can You Really Learn Salesforce Marketing Cloud in 30 Days?
If you’re serious about taking your marketing career to the next level, mastering Salesforce Marketing Cloud could be a game-changer. But with so many features,…

Future Methods in Salesforce: An Overview
Future methods are is a set of code that runs in the background. It is basically an asynchronous process. Don’t forget to check out: Asynchronous…
Popular Salesforce Videos
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…
Process Builder - A Tool every Salesforce Developer must know
Salesforce Process Builder - A Tool every Salesforce developer must know. Learn how to master Process builder Salesforce to automate your business processes. In this…
QuickBooks Salesforce Connector | Setup & Configuration
QuickBooks Salesforce Connector: https://eshopsync.com/quickbooks/ is taking the cloud-based platforms to the new altitudes. Now dealing with QuickBooks unlimited data is much easier than ever before.…
Popular Salesforce Infographics

Salesforce Experience Cloud Benefits For Business Growth
Explore How Salesforce Experience Cloud Can Help Your Business? Get bespoke solutions including: Data integration, time & cost savings.

How Important Is CRM Today? | An Infographic
CRM or Customer Relationship Management has become unavoidable and imperative in the world of business to reach the desired level of success. It has reached…

See How Building Apps on Salesforce Has Tremendous ROI
The pressure that businesses today are under to reduce costs, improve agility, and deliver better results is no joke. Couple that with rapidly evolving technology…