We have a display name expression and it seems to break when we get some specific symbols in input.
This is our displayName script: <display-name-expression>${NEWS_TITLE}</display-name-expression>
Here is the log:
Cannot evaluate script ["use strict";var NEWS_TITLE = 'Ugrasbekjemping viktig ved nyetablering av eng '; var NEWS_TYPE = 'REGULAR'; var NEWS_IMAGE_CAPTION = '<p>Foto: </p>
'; var NEWS_BYLINE_STRING = ''; var NEWS_INGRESS_SHORT = 'har sett på hvordan man kan få høy grovfôravling med minst mulig bruk av plantevernmidler. Det viktigste tiltaket bonden kan gjøre er å bekjempe ugras ved etablering av ny eng.'; var NEWS_INGRESS = 'har sett på hvordan man kan få høy grovfôravling med minst mulig bruk av plantevernmidler. Det viktigste tiltaket bonden kan gjøre er å bekjempe ugras ved etablering av ny eng.'; `${NEWS_TITLE}`.replace(/\s+/g, ' ')]. SyntaxError: Invalid or unexpected token
at DisplayNameResolver.safeEval (bundle.js:1)
at DisplayNameResolver.execute (bundle.js:1)
at HTMLDivElement.<anonymous> (bundle.js:1)
DisplayNameResolver.safeEval @ bundle.js:1
DisplayNameResolver.execute @ bundle.js:1
(anonymous) @ bundle.js:1
The problem here is that display name evaluator stumbles upon contents of the HTML Area. In version 2.1.0 of Content Studio we excluded HTML Area from display name expression. If it’s ok for you to upgrade to XP 7.1 / CS 2.1 then I suggest you do that. We could evaluate fixing it in CS 2.0.4 as well, but this will take some time.
@Alan Did you mean to write TextArea instead of HtmlArea? Because in the contenttype above, NEWS_TITLE is of type TextArea.
I think you could try a quick fix: Change NEWS_TITLE into a TextLine input. Mostly, any type of data in a TextArea is also compatible with TextLine. I think the only exception is certain types of whitespace, like tab or newline or carriage return characters. And even then, the limit might not be on the storage side, but rather that you cannot paste a string with tab/enter into a TextLine input.
No, I meant HtmlArea. Display name expression parses all field values and - in this case - stumbles upon HtmlArea field which can have unpredictable values because of HTML inside. The walkaround is to clear the NEWS_IMAGE_CAPTION field. Or upgrade to Content Studio 2.1.0 where this problem is fixed.