You need to sign in to do that
Don't have an account?
virago81
Dynabean.save() returns nothing
All,
I've tried everything but Dynabean.save doesn't return anything. I've tried sforceClient.create and it returns zip too.
I know that "set" and "create" calls are being made because the API complains if there is an invalid field on "sets" and the callback fires when I use "create" (I've tried both .save() and create() but neither works or returns anything in the saveResult.)
Here are the relevant code snippets. Any help appreciated.
<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js?browser=true"
type="text/javascript"></script>
...
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}");
sforceClient.registerInitCallback(getOpportunity);
...
var renewalOppty = new Sforce.Dynabean("opportunity");
try
{
renewalOppty.set("Name", document.OpptyForm.OpptyName.value);
//renewalOppty.set("Description", document.OpptyForm.OpptyDesc.value);
renewalOppty.set("Description", "My Description");
renewalOppty.set("Type",document.OpptyForm.OpptyType.value);
renewalOppty.set("Amount", m_amount);
renewalOppty.set("LeadSource", m_leadSource);
renewalOppty.set("OwnerId", m_ownerId);
var oCloseDate = new Date("12/31/2006");
renewalOppty.set("CloseDate", oCloseDate);
renewalOppty.set("StageName", m_stageName);
renewalOppty.set("ForecastCategory", "Pipeline");
renewalOppty.set("CurrencyIsoCode", "USD - U.S. Dollar");
//renewalOppty.set("Country", "US");
//var opptyArray = new Array();
//opptyArray[0] = renewalOppty;
saveResult = renewalOppty.save();
alert(typeof saveResult);
//sResult = sforceClient.create(opptyArray,dummy);
I've tried everything but Dynabean.save doesn't return anything. I've tried sforceClient.create and it returns zip too.
I know that "set" and "create" calls are being made because the API complains if there is an invalid field on "sets" and the callback fires when I use "create" (I've tried both .save() and create() but neither works or returns anything in the saveResult.)
Here are the relevant code snippets. Any help appreciated.
<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js?browser=true"
type="text/javascript"></script>
...
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}");
sforceClient.registerInitCallback(getOpportunity);
...
var renewalOppty = new Sforce.Dynabean("opportunity");
try
{
renewalOppty.set("Name", document.OpptyForm.OpptyName.value);
//renewalOppty.set("Description", document.OpptyForm.OpptyDesc.value);
renewalOppty.set("Description", "My Description");
renewalOppty.set("Type",document.OpptyForm.OpptyType.value);
renewalOppty.set("Amount", m_amount);
renewalOppty.set("LeadSource", m_leadSource);
renewalOppty.set("OwnerId", m_ownerId);
var oCloseDate = new Date("12/31/2006");
renewalOppty.set("CloseDate", oCloseDate);
renewalOppty.set("StageName", m_stageName);
renewalOppty.set("ForecastCategory", "Pipeline");
renewalOppty.set("CurrencyIsoCode", "USD - U.S. Dollar");
//renewalOppty.set("Country", "US");
//var opptyArray = new Array();
//opptyArray[0] = renewalOppty;
saveResult = renewalOppty.save();
alert(typeof saveResult);
//sResult = sforceClient.create(opptyArray,dummy);
Thanks for the reply. Adding the mysave prototype does the job.
Just a note though. There is a serious bug in the API. If there is a problem a currency field (for instance if I try to set a currency and the API doesn't recognize it as a double, then the SaveResult just bombs. It comes back as undefined.
Here is the relevant corrected code for anyone who is interested:
...
I haven't tested this, but possibly sforceclient.update() function could be used as a work around.
I haven't tested this, but possibly update() function could be used as a work around.