You need to sign in to do that
Don't have an account?
rupinder jeet
new_Custom_Object.Account = records[0].Account;
new_Custom_Object.NextStep = records[0].NextStep ;
cloning a standard object:exception
hi all,
i am trying to clone a SObject and thus creating a custom object. i am using the following code:
<!-- begin code -->
<!-- replace 'Closed' (without quotes) in the code below with the Status desired for case closure -->
<html>
<head>
<script src="/soap/ajax/8.0/connection.js"></script>
<script src="/desktop/desktopApi.js"></script>
<script>
alert("start");
// Query all the fields of the custom object
var result = sforce.connection.query("select Account,NextStep from Opportunity where Id=: OpportunityId" );
var records = result.getArray("records");
<!-- replace 'Closed' (without quotes) in the code below with the Status desired for case closure -->
<html>
<head>
<script src="/soap/ajax/8.0/connection.js"></script>
<script src="/desktop/desktopApi.js"></script>
<script>
alert("start");
// Query all the fields of the custom object
var result = sforce.connection.query("select Account,NextStep from Opportunity where Id=: OpportunityId" );
var records = result.getArray("records");
// Create an instance of a custom_object
var new_Custom_Object = new sforce.SObject("Opporutnity_cloned__c");
var new_Custom_Object = new sforce.SObject("Opporutnity_cloned__c");
new_Custom_Object.Account = records[0].Account;
new_Custom_Object.NextStep = records[0].NextStep ;
// Create the Object
try
{
try
{
var saveResult = sforce.connection.create( new_Custom_Object );
// Check to see that the object was created successfully
if ( saveResult[0].getBoolean("success") )
{
alert( "Success " );
}
else
{
alert( "Error occurred: " + saveResult[0] );
}
//}
</script>
</head>
<body onload="init()">
<p>
</p>
</body>
</html>
// Check to see that the object was created successfully
if ( saveResult[0].getBoolean("success") )
{
alert( "Success " );
}
else
{
alert( "Error occurred: " + saveResult[0] );
}
//}
</script>
</head>
<body onload="init()">
<p>
</p>
</body>
</html>
plesae tell that where i am wrong in this code. It is giving exception in the query which is highlighted by red color.
regards,
RJS.
nops :) somebody else might have posted it. i checked that answer series too but that seems to be more of like for custom objects. me trying for standard object.
i m facing exception in the query part which is highlighted in the code. pls put in ur valuable suggestions for the same.
best regards,
rjs.
http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=6312#M6312
hey thanks dear.. for the help. i dint check that..
cheers,
rjs