+ Start a Discussion
Abdullah Sikandar 11Abdullah Sikandar 11 

Create a case

Hi Guys,

 Need your help, actually i am new in salesforce so, dont know how to do coding, what i want is that a code in controller that will insert some of the fields which are VF page into Cases comments or description field.

Can anyone help me in this one please?

Scenerio is that whenever the customer press submit button, it will automatically create the case with all the information provide by the customer on VF page? so i need the logic to make the case 
Hi Abdullah Sikandar,

Here is the sample code to create a Case.
<apex:page standardController="Case">
<apex:form id="form1">
<apex:pageBlock id="block1">
<apex:pageBlockSection id="section1">
<apex:inputField value="{!Case.AccountId}" />
<apex:inputField value="{!Case.ContactId}" />
<apex:inputField value="{!Case.Priority}" />
<apex:inputField value="{!Case.Status}" />
<apex:inputField value="{!Case.Origin}" />
<apex:inputField value="{!Case.Description}" />
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!Save}"/>
<apex:commandButton value="Cancel" action="{!Cancel}"/>
Best Regards,
Abdullah Sikandar 11Abdullah Sikandar 11
Hi Mithun,

Question for you, that`s a VF code, right? or Controller Code?
PratikPratik (Salesforce Developers) 
Hi Abdullah,

The above mentioned code by Mithun is Visualforce.

VF code will have <apex:....> Tags
Apex code will have  Class, variables, methods etc.

Hi Abdullah Sikandar,

As Pratik mentioned, the above code is Visualforce.

Best Regards,