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
shobana shobana 1shobana shobana 1 

Create a case clicking a custom button in Account object

My scenario is to create a Custom button in Account object while clicking that button it show some required field in Case their I want to add submit custom button after clicking that it will create a case record from that account.

I am pretty new to Salesforce development. Can anyone give me suggestion to do this.

Thanks in Advance.
Try below Javascript for the Custom button.
var c = new sforce.SObject(“Case”);
//your field values like
var result = sforce.connection.create([c]);
window.location = “/” + result[0].id + “/e”;
} else {
alert(‘Could not create record’ +result);
Please do like below.

<apex:page standardController="Case" action="{!Save}">
do your logic here.
If you have any logic need to do in Save then call the custom controller in the
<apex:page controller="yourClass" action="{!saveLogic}">
Your Controller
public class yourClass {
 public void saveLogic() {
   // your logic
   insert caserec;