• Olof-ISA
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hi
I guess that this is a quite common and simple problem but I cant find any easy way out.
 
I'm trying to update an account with values from a description field on another object. Everything works just fin as loong as I dont use data that contains funny characters as "&", carriage returns and so on.  Tryign to update data with these values makes the script crash...
I'd be really greatfull if anyone have a solution to this!
 
Cheers!
 
/Olof
 
Script sample:
function UppdateAccount() {
var queryResult = sforceClient.Query("Select ID, Name, Description from Account where ID='" + s_AccID + "'");
if (queryResult.getClassName() == "SoapFault") {
alert(
"Error Updating Account: " + queryResult.toString());
}
else {
if (queryResult.size > 0)
{
if (queryResult.size > 0) {
var account = queryResult.records[0];
account.set("Description", s_ACText);
queryResult.records[0] = account;
var sr = sforceClient.Update(queryResult.records);
try {
if (sr.getClassName() == "SoapFault") {
alert(
"Error updating Account: " + sr.toString());
}
}
catch (e) {
if (sr[0].getClassName() == "SaveResult"){
return(true);
}
}
}
}
else
{
alert(
"Couldn't find account, not updated.");
}
}
}