function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC n12SFDC n12 

New case record creation

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



I am using 
Thanks in Advance
Ramu_SFDCRamu_SFDC
The below article should hopefully help

http://salesforce.stackexchange.com/questions/27360/create-a-button-in-vf-page-that-creates-a-new-case-with-certain-record-type