You need to sign in to do that
Don't have an account?
Olof-ISA
Error when handling fields with Carriage Returns, Line Feeds and &-signs
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.");
}
}
}
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.");
}
}
}
or
-Cory
The B33 version uses CDATA sections during the serialization of object values and is not susceptable to special character issues.
Thanks!!
The code doesn't work with B33 do can You easilly tell Why?
Cheers
/Olof
Cheers!
Have You got any samples on how to do the escaping?
/Olof
Thanks a lot! That will do the trick as a quickfix while changing to B33.
/Olof