Service Field with an Image Source data source produces an error during email import: "Field value is longer than acceptable length: 256"

Symptoms

The document definition contains the Service Field with the text type and an Image Source data source. When using an email image import profile, the Image source string may exceed 256 characters which will produce the following error: "Field value is longer than acceptable length: 256".

mceclip2.png

Cause

The length of the Service Field with the text data type is limited to 256 characters.

Resolution

To work around this we may create a regular text field in the document definition and assign the value to it with the script rule:

  1. Create a new text field in the document definition.
  2. Open field properties > Rules tab > New Rule > Script > Next.
  3. Uncheck the Read-only checkmark beside the Field Alias to modify the field.
  4. Click Edit to open Script Editor.
  5. Paste the following code and replace the Field Alias (can be found on step 3).
  6. Save changes and close Script Editor > Finish.

 

//C# code

Context.Field("ImageSource_script").Text = Context.Document.Pages[0].ImageSource + ", from: "
+ Context.Document.Batch.Properties.Get("fc_Predefined:EmailSender") + ", to: "
+ Context.Document.Batch.Properties.Get("fc_Predefined:EmailAddressee");

Result:

mceclip4.png

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.