You need to sign in to do that
Don't have an account?
benfishin
Creating a DynaBean
Code:
Trying to folllow the example in the Sforce AJAX Toolkit beta1 doc. I get the following error.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Create Lead</title> <script src="http://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script> <link href="/css/ie_global.css" rel="stylesheet" type="text/css"> <link href="/css/ie_navigation.css" rel="stylesheet" type="text/css"> <link href="/css/opportunities_styles.css" rel="stylesheet" type="text/css"> <script language="javascript"> function initPage() { //Get Salesforce connection based on users current session id sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_60}"); window.setTimeout(";", 1000); var phone = "{!Contact_Phone}"; if (phone == "") { phone = "{!Account_Phone}"; } var lead = new DynaBean("Lead"); lead.set("FirstName", "{!Contact_FirstName}"); lead.set("LastName", "{!Contact_LastName}"); lead.set("Title", "{!Contact_Title}"); lead.set("Email", "{!Contact_Email}"); lead.set("Phone", phone); lead.set("MobilePhone", "{!Contact_MobilePhone}"); lead.set("Company", "{!Account_Name}"); lead.set("Website", "{!Account_Website}"); lead.set("Street", "{!Account_ShippingStreet}"); lead.set("City", "{!Account_ShippingCity}"); lead.set("State", "{!Account_ShippingState}"); lead.set("PostalCode", "{!Account_ShippingPostalCode}"); lead.set("Country", "{!Account_ShippingCountry}"); var saveResult = sforceClient.Create(lead)[0]; document.getElementById("divErrorMsg").innerHTML = saveResult.toString(); document.getElementById("divErrorMsg").style.display = ""; } </script> </head> <body onload="initPage();"> <div id="divErrorMsg"></div> </body> </html>
Trying to folllow the example in the Sforce AJAX Toolkit beta1 doc. I get the following error.
Error: DynaBean is not defined
Source File: https://na1.salesforce.com/servlet/servlet.Integration?lid=01N300000004VZ4&eid=0033000000EhJH9&enc=UTF-8
Line: 22
Source File: https://na1.salesforce.com/servlet/servlet.Integration?lid=01N300000004VZ4&eid=0033000000EhJH9&enc=UTF-8
Line: 22
What am I missing?
Thanks
Source File: https://na1.salesforce.com/servlet/servlet.Integration?lid=01N300000004VZ4&eid=0033000000EhJH9&enc=UTF-8
Line: 22
the "b" in Dynabean is is case-sensitive, it should be "new Sforce.Dynabean", not "new Sforce.DynaBean"
Many thanks to gsickal and DevAngel .
The issue was:
var lead = new Sforce.Dynabean("Lead"); //Note: case sensitive and not the same case in the Sforce Ajax Toolkit beta 1 doc. (I am using beta 3 in this code).
The following appears to work (I still have some stress testing to do). Hope this sheds some light for anyone else trying to accomplish something similar. Please let me know if you if you figure out some fancier DHTML or error handeling.
-BenFishin
Code:
I have been using the toolkit since the first beta & have gone through several upgrades already, but I've never encountered a rewrite of the "getting started" doc that came with the first beta. Most of the information in that older document is no longer correct. Is there any information besides the "autodocs"?
Thanks,
- Mike
The best doc is the stuff bundeled with the eclipse AppExchange plug-in.
download Eclipse, then add the AppExchange stuff, ( instructions are on the appex developer network) then click help, find the AppExchange help docs and start searching / reading...
it's mostly autodoc, but is searchable and the s-control editing features of this combo are very slick.