You need to sign in to do that
Don't have an account?
SFDC n12
New case record creation on button click visualforce page
Hi,
I am having a following requirement for which i need help,
1) I am having a text box (comments) and followed by a button in my visualforce page
2) when i enter the value in the comments and click on the button a new case has to be created and the comments that i have entered should be mapped to the case and case subject is to be "Lead override"
My controller :
public class AF_ScriptController {
public String status {get;set;}
public Lead_Object__c obj {get; set; }
/**
** Constructor
**/
public AF_ScriptController (ApexPages.StandardController controller) {
String newId = ApexPages.currentPage().getParameters().get('leadId');
System.debug ('new Id *** :' + newId);
if (newId != '') {
obj = [Select Id,Lead_Override_Comments__c,First_Name__c,Last_Name__c,Dealer_Type__c,Products_Dealership__c,F_I_Manager__c,Contracts_Electronically__c,Dealer_Track_RouteOne__c,What_percent_of_inventory_has_a_selling__c,What_percent_of_your_inventory_has_less__c,What_percent_of_your_inventory_is_newer__c,How_many_front_line_ready_units_do_you_c__c,What_are_your_average_monthly_used_vehic__c,Service_Department_on_site__c,Dealership_Retail__c,Dealership_Permanent_Building__c,Dealership_Payed__c,How_many_years_have_you_been_in_business__c,Leadstatus__c, test__c, salutation__c from Lead_Object__c where id = :newId limit 1];
if (obj.LeadStatus__c == 'Qualified' ) {
System.debug ('Qualified *** : ' + status);
status = System.Label.AF_QualifiedScript;
}
else {
status = System.Label.AF_UnqualifiedScript;
System.debug ('UnQualified *** :' + status);
}
}
}
}
Please help me how to do this
Thanks in Advance
I am having a following requirement for which i need help,
1) I am having a text box (comments) and followed by a button in my visualforce page
2) when i enter the value in the comments and click on the button a new case has to be created and the comments that i have entered should be mapped to the case and case subject is to be "Lead override"
My controller :
public class AF_ScriptController {
public String status {get;set;}
public Lead_Object__c obj {get; set; }
/**
** Constructor
**/
public AF_ScriptController (ApexPages.StandardController controller) {
String newId = ApexPages.currentPage().getParameters().get('leadId');
System.debug ('new Id *** :' + newId);
if (newId != '') {
obj = [Select Id,Lead_Override_Comments__c,First_Name__c,Last_Name__c,Dealer_Type__c,Products_Dealership__c,F_I_Manager__c,Contracts_Electronically__c,Dealer_Track_RouteOne__c,What_percent_of_inventory_has_a_selling__c,What_percent_of_your_inventory_has_less__c,What_percent_of_your_inventory_is_newer__c,How_many_front_line_ready_units_do_you_c__c,What_are_your_average_monthly_used_vehic__c,Service_Department_on_site__c,Dealership_Retail__c,Dealership_Permanent_Building__c,Dealership_Payed__c,How_many_years_have_you_been_in_business__c,Leadstatus__c, test__c, salutation__c from Lead_Object__c where id = :newId limit 1];
if (obj.LeadStatus__c == 'Qualified' ) {
System.debug ('Qualified *** : ' + status);
status = System.Label.AF_QualifiedScript;
}
else {
status = System.Label.AF_UnqualifiedScript;
System.debug ('UnQualified *** :' + status);
}
}
}
}
Please help me how to do this
Thanks in Advance
Then inside your constructor do below:
in VF:
All Answers
Apex Class Additional code:
VF Additional Code:
You can modify the above code to meet your requirement, I just posted it in order to give you idea on how you can do it! Hope this helps!
PS: if this answers your question then hit Like and mark it as solution!
1) I want to populate the text that i enter in the comments field on my visualforce page to description of my case , right now its not coming , what should i use in the below component so that its getting stored in the description field of my case
<b> <apex:inputText style="width: 270px; height: 100px;" required="true"/></b>
2) I am having a custom field in my lead object called as "leadobject__c" which captures all the values from a custom object (lead) to the standrad object lead
Note: I have a custom object lead where i am populating all my values in vf page and using a controller i am copying all the values to standard lead object again
Now the case is getting created , but its not assigned to the lead record that is getting created, i want the custom field " lead__c " on the "case" object to be filled in with the lead id that is getting created.
Help me how to achieve these 2 things alone pls
Thanks for ur help
Then inside your constructor do below:
in VF:
csInstance.Lead__c = (Id)newId;
i am getting
Error: Compile Error: Variable does not exist: newId at line 40 column 32
and in my vf page when i add the bwlo statement , i am gettig the following error
<b> <apex:inputText value="{!csInstance.Description}" style="width: 270px; height: 100px;" required="true"/></b>
Error: Invalid field csInstance for SObject Lead_Object__c