+ Start a Discussion
finalistfinalist 

Is there a way to handle newline chars in long text field within S-Control?

I've created an S-Control that creates or updates a custom object based on values in an Opportunity, and one of the fields that I'm trying to copy is a long text field.

Everything's fine, as long as there are no newline characters in the field; you know, as long as nobody tried to make their text legible.

As soon as I try to load a record that has a newline in that field, the S-Control locks up; I tried getting around the issue by using sforce.connection.retrieve() rather than directly assigning the value to a variable, but they're both strings in the end, and it doesn't even throw an error, best I can tell; it just dies.

Is there a workaround, or do I just tell the reps to copy the field manually?

... hmm ... where's my toolbar -- I hope this doesn't break anything ...
try {
// conn.retrieve takes ids as an array
oppIds.push(oppId);
result = conn.retrieve("NOTES_FOR_IMC_FROM_SALES__c", "Opportunity", oppIds);

for (i = 0; i < result.length; ++i) {
parseLongText(result[i].NOTES_FOR_IMC_FROM_SALES__c);
}

} catch(ex) {
displayError(ex);
}