i am creating a button which will create new record. this is my code
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var curnc= new sforce.SObject("TR_Currency_Approval__c");
curnc.Name="{!TR_Currency__c.Name}";
curnc.Active__c="{!TR_Currency__c.Active__c}";
curnc.Description__c="{!TR_Currency__c.Description__c}";
var result=sforce.connection.create([curnc]);
if(result[0].success == 'true'){
alert('An New Currency with Name - ' + TR_Currency__c.Name + ' was Created Successfully.');
}
Please let me know any errors,
if(result[0].success == 'true'){...}else{alert(result[0].errors[0]);}
. Like this you'll be able to get the error message.