• Mike Shawaluk
  • 10 Points
  • Member since 2005

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 9

I'm developing a number of s-controls that use the AJAX toolkit, and our development practices dictate that we comment our code. Currently I am using standard JavaScript comments, but those appear in "View Source", and they increase the load time of the page. Is there a way to include a "hidden" comment (i.e. one that is in the s-control source, but won't appear on the deployed page)? I've searched the help files and can't find a reference to this ability.

If this ability doesn't currently exist, something like {!Comment blah blah blah} would seem to be a logical way to handle this, and would be a great extension in a future release.

- Mike
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<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 = "";
<body onload="initPage();">
<div id="divErrorMsg"></div>

Trying to folllow the example in the Sforce AJAX Toolkit beta1 doc. I get the following error.
What am I missing?
I have a java applet that can push a URL to a browser. I've collected the Case number 00001000 via the telephone and now I'm trying to figure out how to build a URL that will display it on the salesforce.com page.

I noticed on the Custome link page the sample custom link "https://na1.salesforce.com/opp/oppedit.jsp?accid={!Account_ID}&opp3=Up-sell+/+Cross-sell&opp5=Existing+Customer&opp6=Customer+Support"

refers to a '/opp/oppedit.jsp'

If I could find the equivilent for a case I would have what I'm looking for

This is my first post and I did do a search of the archives prior to posting this.


In an S-Control, I'm retrieving the HTMLWrapper (to a string) using sforceClient.Query("Select HtmlWrapper From SControl where Id='"+str+"'");. i want to run the retrieved S-Control script. But, when i used document.write() to run the script, it throws the following error!

A Runtime Error has occurred.
Do you wish to Debug?

Line: 29
Error: 'sforceClient' is undefined.

Am i using bad logic to run the script?

Putting the whole thing in a simple way, How can I execute an S-Control from another S-Control? Please help!

Thanks in advance.
  • January 03, 2006
  • Like
  • 0
The application that I am creating needs to send an email out upon completion of a process. The process happens in a S-Control that updates a Custom Object.

Is there a way of sending emails through an S-Control? I have been hearing of an emailauthor.jsp but have not been able to find info on it.


  • December 05, 2005
  • Like
  • 0
I'm using AJAX to create a sControl on which form there is a date input field. Is there a way to invoke the standard sfdc date-picker?
  • October 14, 2005
  • Like
  • 0

I am getting an error creating the new Opportunity with the AJAX toolkit.

I have read through this message board and found that the object parameter must be in the form of an array, but I still get the following messge when I interogate the SoapFault object (toString):

"faultstring: org.xml.sax.SAXParseException:  The reference to entity "D" must end with the ";" dilimeter.  faultcode: soapenv:Server"

Can someone help me how I can troubleshoot this??

Here is my create script:

var Opp = new DynaBean("Opportunity")

//A series of set statements

var saveResult = sforceClient.Create([Opp]);

if (saveResult.getClassName() == "SoapFault") {


} else {

     alert("It worked!");


  • September 01, 2005
  • Like
  • 0
I have a custom text field on a lead that is 50 characters. I have the equivalent field on the Opportunity that is the same length. I have a mapping between that lead field and the opportunity. All works fine with that.

I wanted to have the same custom lead field map to a field on the contact record. So I created a formula field on the lead that looked like this:

TRIM(LEFT({!Project_Location__c}, 50))

This should guarantee the result is a 50 character value or less.

When I map this field to a field on the contact, I get an error saying that the lead field is 1300 characters in length and is more than the contact field of 50.

I believe this is because the formula itself can be up to 1300 characters. However, this should be comparing the formula result with the length of the contact field.

To get around this, I made the contact field a 1300 length text area (long) field. This saved okay. However, the information from the formula field did not transfer over.

PLease let me know if I am doing something wrong or if the product just does not support this. If it doesn't support it, I'd like to make a feature request that the lead conversion process supports mapping the result of a formula field to a non-formula field of the same data type.
  • August 29, 2005
  • Like
  • 0