like lead object i developed one custom button..when ever i click on button i need to create account and person account(person account is enabled in my org).
this my code. account is created but person account is not created
{!REQUIRESCRIPT("/soap/ajax/37.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/37.0/apex.js")}
var accnt = new sforce.SObject("Account");
accnt.Id = '{!Account.Id}';
accnt.Name = prompt('', '{!My_Leads__c.Lead_Name__c}');
var result = sforce.connection.create([accnt]);
if (result[0].getBoolean("success")) {
alert('Account created successfully');
}
var cnt = new sforce.SObject("Account");
cnt.Name = prompt('', '{!My_Leads__c.Lead_Name__c}');
var result1 = sforce.connection.create([cnt]);
if (result1[0].getBoolean("success")){
alert('Person contact created successfully');
window.location.reload();
}
else {
alert('Error : ' + result);
}