• Kraulin
  • NEWBIE
  • 0 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
Any idea why this query is failing? I've created an sControl that contains two queries. They are identical except that one has a where clause. The query with out the where clause executed and returns successfully, but when you try to run it with the query with the where clause, it throws a SAX Parser Exception. Both queries return rows in the sforce explorer. Ideas? -=Bryan scontrol source below... Edit: It appears that I cannot properly post HTML and Javascript to the forum... but it appears to be there when I go to edit... so maybe the people who need to see it will... hmmm.... If you take an Ajax example with doQuery in it, one can take these two lines and recreate the error... var saveResult = sforceClient.Query("Select AccountNumber, Id, Name, NumberOfEmployees from Account where NumberOfEmployees < 19"); var saveResult = sforceClient.Query("Select AccountNumber, Id, Name, NumberOfEmployees from Account"); ================================================

[SCRIPT src="https://www.sforce.com/ajax/beta2/sforceclient.js" type=text/javascript][/SCRIPT]

[SCRIPT type=text/javascript] [!-- 


//=========================================================

function initPage() {
  sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_60}");
  window.setTimeout(";", 1000);
  doQuery();
}//end of initPage


//=========================================================

function doQuery(){
	var saveResult = sforceClient.Query("Select AccountNumber, Id, Name, NumberOfEmployees from Account where NumberOfEmployees < 19");
	//var saveResult = sforceClient.Query("Select AccountNumber, Id, Name, NumberOfEmployees from Account");
	
	if (saveResult.getClassName() == "QueryResult") {
		alert("saveResult="+saveResult)
    return saveResult.records;    	
  }//end of if
  
  //If the first value in the result array is null then it's a fault.
  if(saveResult[0] == null) {
  	alert("doQuery::saveResult="+saveResult);
    //Output the fault message to the error function.
    document.getElementById("divErrorMsg").innerHTML = saveResult.toString();
    document.getElementById("divErrorMsg").style.display = "";
  }//end of if save result == null 
  else{
    //Success! The Create call on the sObjects array resulted in SaveResults, not a fault.
    var errorMsg = "";
    //Check for success on each result
    for(c=0;c<saveResult.length;c++) {
      sr = saveResult[c];
      if (sr.success == "false") {
         errors = sr.errors;
        //Append the errors to the errorMsg variable.
        errorMsg += errors.toHtmlString + "";
      }//end of if
    }//end of for loop on the save result.

    //If the errorMsg variable has information, output it to the error div on the page.
    if(errorMsg!="") {
    	document.getElementById("divErrorMsg").innerHTML = errorMsg;
    	document.getElementById("divErrorMsg").style.display = "";
    } else {
    	return sr;
    }//end of if/else
	}//end of else
}//end of doQuery()

//=========================================================

//-->
[/SCRIPT]







[DIV id=divErrorMsg][/DIV]

[DIV id=divDebugMsg][/DIV]




================================================

Message Edited by Kraulin on 10-04-2005 07:58 AM

Message Edited by DevAngel on 10-04-2005 09:42 AM

I've been developing an ajax scontrol for a customer and it works perfectly... however when I take exactly the same code and try to put it into a different org, I get the error below:

Error: Invalid Data.
Review all error messages below to correct your data.

Bad Link Definition


1) Why do I get this error?
2) What exactly causes this error?
3) How do I debug this error?
4) What kind of pre-processing is done so that this error can be produced?

-=Bryan

Message Edited by Kraulin on 10-02-2005 05:50 PM

Message Edited by Kraulin on 10-02-2005 05:50 PM

I have written an scontrol with the ajax toolkit that at one point can take a date object and save it back to salesforce.

Now I have it working fine in firefox 1.0.6 and an alert that I have in the code creates the same output "newDate=Thu May 12 02:02:02 EDT 2005".

However when I load up that same scontrol in IE6 and I go to save my object I get:
"saveResult=faultstring: java.lang.NumberFormatException: Unexpected characters
faultcode: soapenv:Server"


How can the same string work in FF1.0.6 and not in IE6? I know there are browser incompatabilities, but this is seralized data going to the same back end...

Any thoughts?

-=Bryan
  • September 14, 2005
  • Like
  • 0
I downloaded LineItems2Assets.htm and pasted the contents into the scontrol code window, then I save it and salesforce says I have a "Bad Link Definition".

Also I get at the top of the page:
"Error: Invalid Data. Review all error messages below to correct your data."

What am I doing wrong here?

-=Bryan
This is unrelated (I think) to my earlier Date-related post.

The following problem in the AJAX API on the Salesforce servers started happening to me this afternoon around 3:30 - 4 EST:

Error: toIsoDate is not defined
Source File: https://www.sforce.com/ajax/beta2/dynalib.js
Line: 213

The question I have is whether it's me or a bug in the API. I've tested IE6 on XP and Firefox on OSX, using the AJAX beta2 kit. My code calls Retrieve to get an Opportunity, calls "new DynaBean('Opportunity')" and a series of set('...',...) calls to clone the retrieved Opportunity, then calls Create(new Array(myNewOpp)) to save it. It's unclear to me at this point exactly where the "toIsoDate" method is called within the API code. I don't call it directly.

Thanks,

kirt
  • October 05, 2005
  • Like
  • 0
Using AJAX beta 2 API in an s-control, I am trying to clone Opportunity data. In the process of copying dates from one Opportunity to another, they are being altered. I suspect that it's a timezone issue, but I'm not certain. Here's my code:

if (oldOpp.get("CloseDate") != '')
newOpp.set("CloseDate",oldOpp.get("CloseDate"));
// ...
var createResult = sforceClient.Create( new Array(newOpp) );

The result is that my newly created Opportunity's CloseDate is set back one calendar day. Is there an accepted best practice for moving dates between objects and/or fields using the AJAX toolkit that will guarantee that the dates don't get altered?

Thanks very much for your help!

kirt
  • October 05, 2005
  • Like
  • 0
Any idea why this query is failing? I've created an sControl that contains two queries. They are identical except that one has a where clause. The query with out the where clause executed and returns successfully, but when you try to run it with the query with the where clause, it throws a SAX Parser Exception. Both queries return rows in the sforce explorer. Ideas? -=Bryan scontrol source below... Edit: It appears that I cannot properly post HTML and Javascript to the forum... but it appears to be there when I go to edit... so maybe the people who need to see it will... hmmm.... If you take an Ajax example with doQuery in it, one can take these two lines and recreate the error... var saveResult = sforceClient.Query("Select AccountNumber, Id, Name, NumberOfEmployees from Account where NumberOfEmployees < 19"); var saveResult = sforceClient.Query("Select AccountNumber, Id, Name, NumberOfEmployees from Account"); ================================================

[SCRIPT src="https://www.sforce.com/ajax/beta2/sforceclient.js" type=text/javascript][/SCRIPT]

[SCRIPT type=text/javascript] [!-- 


//=========================================================

function initPage() {
  sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_60}");
  window.setTimeout(";", 1000);
  doQuery();
}//end of initPage


//=========================================================

function doQuery(){
	var saveResult = sforceClient.Query("Select AccountNumber, Id, Name, NumberOfEmployees from Account where NumberOfEmployees < 19");
	//var saveResult = sforceClient.Query("Select AccountNumber, Id, Name, NumberOfEmployees from Account");
	
	if (saveResult.getClassName() == "QueryResult") {
		alert("saveResult="+saveResult)
    return saveResult.records;    	
  }//end of if
  
  //If the first value in the result array is null then it's a fault.
  if(saveResult[0] == null) {
  	alert("doQuery::saveResult="+saveResult);
    //Output the fault message to the error function.
    document.getElementById("divErrorMsg").innerHTML = saveResult.toString();
    document.getElementById("divErrorMsg").style.display = "";
  }//end of if save result == null 
  else{
    //Success! The Create call on the sObjects array resulted in SaveResults, not a fault.
    var errorMsg = "";
    //Check for success on each result
    for(c=0;c<saveResult.length;c++) {
      sr = saveResult[c];
      if (sr.success == "false") {
         errors = sr.errors;
        //Append the errors to the errorMsg variable.
        errorMsg += errors.toHtmlString + "";
      }//end of if
    }//end of for loop on the save result.

    //If the errorMsg variable has information, output it to the error div on the page.
    if(errorMsg!="") {
    	document.getElementById("divErrorMsg").innerHTML = errorMsg;
    	document.getElementById("divErrorMsg").style.display = "";
    } else {
    	return sr;
    }//end of if/else
	}//end of else
}//end of doQuery()

//=========================================================

//-->
[/SCRIPT]







[DIV id=divErrorMsg][/DIV]

[DIV id=divDebugMsg][/DIV]




================================================

Message Edited by Kraulin on 10-04-2005 07:58 AM

Message Edited by DevAngel on 10-04-2005 09:42 AM

I've been developing an ajax scontrol for a customer and it works perfectly... however when I take exactly the same code and try to put it into a different org, I get the error below:

Error: Invalid Data.
Review all error messages below to correct your data.

Bad Link Definition


1) Why do I get this error?
2) What exactly causes this error?
3) How do I debug this error?
4) What kind of pre-processing is done so that this error can be produced?

-=Bryan

Message Edited by Kraulin on 10-02-2005 05:50 PM

Message Edited by Kraulin on 10-02-2005 05:50 PM

I have written an scontrol with the ajax toolkit that at one point can take a date object and save it back to salesforce.

Now I have it working fine in firefox 1.0.6 and an alert that I have in the code creates the same output "newDate=Thu May 12 02:02:02 EDT 2005".

However when I load up that same scontrol in IE6 and I go to save my object I get:
"saveResult=faultstring: java.lang.NumberFormatException: Unexpected characters
faultcode: soapenv:Server"


How can the same string work in FF1.0.6 and not in IE6? I know there are browser incompatabilities, but this is seralized data going to the same back end...

Any thoughts?

-=Bryan
  • September 14, 2005
  • Like
  • 0
Hi,

i am trying to adds leads to a campaign with the AJAX toolkit beta1 and the CampaignMember object, but it fails.

A snippet of code:

..........

sforceClient.setBatchSize(10);
_qrLeads = sforceClient.Query("Select Id, LastName, FirstName, State From Lead where State = '"+provincia+"'");

if (_qrLeads.size > 0) {
for (var i=0;i var lead = _qrLeads.records[i];
var campMember = new DynaBean("CampaignMember");
campMember.set("CampaignId","{!Campaign_ID}");
campMember.set("LeadId",lead.id);
campMember.set("Status","Sent");
var saveResult = sforceClient.Create(campMember)[0];
}
}

.......

Any Help??

Thanks.

Victor Alvarez Fuente