-
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 Marketing Cloud Benefits in 2024
Contents Why choose the Salesforce Marketing Cloud? Key Benefits of Salesforce Marketing Cloud Personalization Multi-Channel Marketing Marketing Automation Data-Driven Insights Audience Segmentation Lead Management Scalability…
Why You Should Consider Investing In Salesforce Lightning
Salesforce thought of perhaps the greatest development a year ago, that is Salesforce Lightning. It is a keen instrument that encourages you to sell quicker,…
How to Clone Multiple Flows From Same or External Salesforce Orgs?
Salesforce Flows are powerful automation tools that enable businesses to create custom, declarative workflows without the need for extensive coding. They streamline processes, enhance user…
Popular Salesforce Videos
How to Create a Connected App in Salesforce? | What is a Connected App?
Watch this video to learn how to create a Salesforce connected app to enables an external application to integrate with Salesforce using APIs. If you…
Generative AI: What Diverse Data Types Can It Create? | Salesforce
Imagine a technology that can take various types of data – from text and images to music and even beyond – and create something entirely…
Salesforce Apex Tutorial: Data Types
In this lesson, we are covering Salesforce Apex Data Types and we are covering primitive data types.
Popular Salesforce Infographics
Top 5 Affordable Salesforce Integration Apps for SMBs
Salesforce is a CRM platform that allows small businesses to manage all of their sales, marketing and customer service communications in one place. Launched back…
How Salesforce Outsourcing Can Help Your Business Grow
We all know how beneficial is Salesforce for any business but people still wonder if it is beneficial to go for Salesforce Outsourcing services. This…
Sneak Peek: Latest Features And Updates of Salesforce commerce Cloud
Here is an infographic of the Latest Features And Updates of Salesforce commerce Cloud