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
dasari123dasari123 

Undefined is not a function in javascript

Hi,
   I am getting undefined is not a function as error when i click a button .

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
var acct = new sforce.SObject("Account");
acct.name = 'New Account';
acct.phone = '515-123-4567';
var result = sforce.connection.create([acct]);


if(result[0].getboolean("success"))
{
alert('Record created Successfully' +result);
}
else
{
alert('could not create record' +result);
}

 Can someone help me where iam lacking exactly
Anoop yadavAnoop yadav
Hi,

Try 
result[0].success == 'true'

instead of
(result[0].getboolean("success")

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
var acct = new sforce.SObject("Account");
acct.name = 'New Account';
acct.phone = '515-123-4567';
var result = sforce.connection.create([acct]);


if(result[0].success == 'true')
{
alert('Record created Successfully' +result);
}
else
{
alert('could not create record' +result);
}

logontokartiklogontokartik
Hi,

Javascript methods are case sensitive. In your code getboolean is defined wrong it has to be getBoolean()

Thank you.
Kartik