Reputation: 107
I have encoded string data to base64 format and setted the output to custom field which is type is long text. In the user interface of the record I could see whole output of encoded value. But while try to get the output value with using rec.getText({fieldId:'customfieldname'}) somehow it breaks the value and doesn't return whole value. Is there any limit size of custom field value?
UserEvent script to get the custom field value:
function beforeSubmit(scriptContext) {
try {
var invrecord = scriptContext.newRecord;
var encodedata = invrecord.getText({fieldId: 'customfield'});
log.debug({title:'Custom field value',
details: encodedata});
return true;
}
catch (e) {
log.error({
title: e.name,
details: e.message
});
return false;
}}
return {
beforeSubmit: beforeSubmit, };});
To encode field value I have used code below:
function encodeBase64Binary(strdata) {
try{
var base64EncodedString = encode.convert({
string: strdata,
inputEncoding: encode.Encoding.UTF_8,
outputEncoding: encode.Encoding.BASE_64
});
return base64EncodedString;
}
catch (e) {
log.error({
title: e.name,
details: e.message)}
}
Upvotes: 1
Views: 1262
Reputation: 1784
The value of the field contains the value you're looking for, however, log.debug
truncates the value to 3,999 characters. That's why you're not seeing the complete value.
Upvotes: 3