-
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
Dashboards in Salesforce - A Brief Guide
Dashboards in Salesforce are graphical representations of reports. Visualize data from reports as components. These components provide a summary of your organization's key analytics and…
2020 Branding Guidelines for Partners in the Salesforce Ecosystem
The Salesforce Partner Program gives the opportunity to its partners to build and grow successful businesses while delivering customer success. With this program, Independent Software…
Control Salesforce Lightning Tabs With Next & Back Buttons
Hello, In this post, we are going to create a sample lightning component to control <lightning:tab> with Next and Back buttons. In this code we…
Popular Salesforce Videos
Which Is Better Career Salesforce Admin or Developer?
Wondering Which is the better Career, Salesforce Admin or Salesforce Developer? Watch this video and join this group to learn all about it. Join this…
Dreamforce to You London 2019: Round-up Video!
Great to contribute to the Salesforce #Dreamforcetoyou event as a Cloud Social Influencer and here is my roundup.
Difference between Contacts and Subscribers in Salesforce Marketing Cloud
Cameron Robert from Datarati explains the difference between Contacts and Subscribers in Salesforce Marketing Cloud. What you'll learn: » The difference between a Contact and…
Popular Salesforce Infographics
What are Salesforce Lightning Web Components?
Lightning Web Components ( LWCs ) are User Interface (UI) framework and utilized for creating applications with desktop and mobile technologies. This framework acts as…
Top Salesforce Trends For 2023
When it comes to managing customer databases, Salesforce is leading the pack. Companies are increasingly relying on this powerful tool for its unrivalled flexibility and…
Salesforce Marketing Cloud
Salesforce Marketing Cloud is a platform where relevant and personalized journeys are delivered across different devices and channels. This allows the marketers to deliver right…