• benfishin
  • NEWBIE
  • 0 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 10
    Replies
Code:
<!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.
 
 
What am I missing?
 
Thanks
 
Can I not do a get and set with the same retrieve object? Does not update the Status.
 
  //Get Salesforce connection based on users current session id
    sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_60}");
    window.setTimeout(";", 1000);   
 var orderIds = new Array();
    orderIds[0] = "{!Order_ID}";
    var orderRetrieve = sforceClient.Retrieve("AccountId, Status", "Order", orderIds);
if(orderRetrieve[0] != null) {
   var orderAccountId = orderRetrieve[0].get("AccountId");
alert("AccountId - " + orderAccountId);
alert("Status - " + orderRetrieve[0].get("Status"));
    orderRetrieve[0].set("Status", "5 - Completed");
alert("Status - " + orderRetrieve[0].get("Status"));
    sforceClient.Update(orderRetrieve);
}
Hi,
 
Can a run a query like this in Salesforce?
 
Select Some field, count(*) group by Some field
having count(*) >1
 
Thx
Code:
<!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.
 
 
What am I missing?
 
Thanks
 
Can I not do a get and set with the same retrieve object? Does not update the Status.
 
  //Get Salesforce connection based on users current session id
    sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_60}");
    window.setTimeout(";", 1000);   
 var orderIds = new Array();
    orderIds[0] = "{!Order_ID}";
    var orderRetrieve = sforceClient.Retrieve("AccountId, Status", "Order", orderIds);
if(orderRetrieve[0] != null) {
   var orderAccountId = orderRetrieve[0].get("AccountId");
alert("AccountId - " + orderAccountId);
alert("Status - " + orderRetrieve[0].get("Status"));
    orderRetrieve[0].set("Status", "5 - Completed");
alert("Status - " + orderRetrieve[0].get("Status"));
    sforceClient.Update(orderRetrieve);
}
A new version (V2.1) of DBAmp as been posted at the DBAmp open source project. Details are available at www.forceamp.com . The new version provides UPDATE /DELETE support as well as some performance enhancements. Questions regarding DBAmp can be posted in this forum (Open Source).

Thanks,
Bill Emerson
forceAmp.com

Message Edited by qman on 10-28-2005 05:14 PM

  • October 26, 2005
  • Like
  • 0