CurrentText One-line Cleanup
Use a Rearrange script to flatten multiline text.
CurrentText = CurrentText.replace(/[\r\n]+/g, " ");When to use
Use when object output needs one line.
Notes
This is code, so it has a copy button.
Phase 4 ยท Reference Material
Phase 4 extends the Transformer Library with practical Transformer action patterns and low-level troubleshooting notes.
Use a Rearrange script to flatten multiline text.
CurrentText = CurrentText.replace(/[\r\n]+/g, " ");Use when object output needs one line.
This is code, so it has a copy button.
Cleans simple HTML paragraph text in a Rearrange object.
CurrentText = CurrentText
.replace(/<\/p>/gi, "\n")
.replace(/<p[^>]*>/gi, "")
.replace(/ /gi, " ");Use when mail body content comes from simple HTML.
Do not use for complex HTML layout.
Use a Delete action with an XPath that matches duplicate rows.
Detail[FIELD_ID = preceding-sibling::Detail/FIELD_ID]Use when the XML contains repeated records and only the first should remain.
Confirm the current parent node in Transformer before applying.
Matches elements whose normalized text is blank.
*[normalize-space(.) = ""]Use for cleanup passes when blank XML elements cause layout issues.
Be careful: parent nodes containing only child elements may also have blank string values.
Matches all Detail records after the first.
Detail[position() > 1]Use for removing repeated header-style nodes under the same parent.
Do not use if each detail is meaningful.
Condition expression requiring a real value.
normalize-space(FIELD_NAME) != ""Use on Transformer actions that should only run when a field exists.
Whitespace-only fields become empty.
Condition expression for a specific text value.
normalize-space(Status) = "Open"Use to trigger actions based on a status or flag.
XPath text comparisons are case-sensitive.
Builds a reusable HTML button from a URL JobInfo.
var url = job.getJobInfo("<UrlJobInfo>");
if (url && !/^https?:\/\//i.test(url)) url = "https://" + url;
CurrentText = '<a href="' + url + '"><span style="text-decoration:none;font-weight:bold;">Open Link</span></a>';Use when a report/email object must become a clickable link.
Email clients vary in how they handle styling.
Use narrow XPath selection before heavy actions.
Use Delete, Sort, or Rearrange actions on the smallest possible node set.
This is a tip, so no copy button.
Preview may look correct while submitted/output data differs.
Check runtime JobInfos, ranges, selected nodes, and execution context.
This is explanatory guidance, so no copy button.
Phase 5 adds related-topic guidance to reduce duplicate entries and make reusable patterns easier to find.