Read a JobInfo
Reads a JobInfo value into a variable.
var value = job.getJobInfo("<JobInfoName>");When to use
Use when a module needs metadata created earlier in the workflow.
Notes
Always handle missing or empty values.
Phase 4 ยท Reference Material
Phase 4 extends the JavaScript Library with practical Lasernet scripting patterns, string handling, JobInfo usage, Base64 handling, and HTML output helpers.
Reads a JobInfo value into a variable.
var value = job.getJobInfo("<JobInfoName>");Use when a module needs metadata created earlier in the workflow.
Always handle missing or empty values.
Writes a calculated value back to JobInfo.
job.setJobInfo("<JobInfoName>", value);Use to pass values to later modules such as MailOut, PDF, output, or archive steps.
Do not overwrite an existing JobInfo unless that is intentional.
Reads how many values exist for a repeated JobInfo.
var count = job.getJobInfoCount("<JobInfoName>");Use when processing arrays such as multiple printers, copies, recipients, or attachments.
Count may be zero; guard your loop.
Loops through indexed JobInfo values.
var count = job.getJobInfoCount("<JobInfoName>");
for (var i = 0; i < count; i++) {
var value = job.getJobInfo("<JobInfoName>", i);
// process value
}Use when the same JobInfo name contains multiple values.
Confirm the exact Lasernet API overload available in your version.
Normalizes text before comparison.
CurrentText.trim().toLowerCase() == "no"Use for case-insensitive yes/no style checks.
Guard against null if CurrentText may be missing.
Short conditional expression for object text output.
(CurrentText.trim().toLowerCase() == "no") ? "X" : "";Use for short field-level output conditions.
Use normal if/else when the logic becomes hard to read.
Checks text is not empty before applying comparison logic.
(CurrentText != "" && CurrentText.trim().toLowerCase() == "no") ? "" : "X";Use when blank values should not be treated the same as no.
Confirm the desired blank behavior before using.
Builds an HTML anchor from a JobInfo URL.
var url = job.getJobInfo("<UrlJobInfo>");
if (url && !/^https?:\/\//i.test(url))
url = "https://" + url;
CurrentText =
'<a href="' + url + '" target="_blank">' +
'<span style="text-decoration:none;color:#ffffff;font-weight:bold;">' +
'Click to Pay' +
'</span>' +
'</a>';Use for clickable buttons or links in HTML output.
Some email clients may ignore target="_blank".
Static HTML link sample.
<a href="https://www.example.com">Pay here</a>Use for simple hyperlink testing before adding dynamic JobInfo logic.
Replace example.com with a redacted or approved public URL only.
Decodes a Base64 PDF string and stores it as binary JobInfo.
var b64 = job.getJobInfo("<Base64JobInfo>");
if (b64) {
b64 = ("" + b64).replace(/\s+/g, "");
var pdfBin = Base64.decode(b64);
job.setJobInfoBinary("MailAttachment", pdfBin);
}Use when XML or API data contains a Base64 PDF that must be emailed.
Always remove whitespace before decoding.
Loops through repeated Base64 values and creates multiple binary attachments.
var count = job.getJobInfoCount("<Base64JobInfo>");
for (var i = 0; i < count; i++) {
var b64 = job.getJobInfo("<Base64JobInfo>", i);
if (!b64) continue;
b64 = ("" + b64).replace(/\s+/g, "");
var pdfBin = Base64.decode(b64);
job.setJobInfoBinary("MailAttachment", pdfBin);
}Use when each Base64 document should remain a separate email attachment.
Confirm attachment name handling separately.
Combines fields and removes illegal filename characters.
var name = job.getJobInfo("<DocumentNumber>") + "_" + job.getJobInfo("<Account>");
name = name.replace(/[\\/:*?"<>|]+/g, "_");
job.setJobInfo("<OutputFileName>", name + ".pdf");Use for output/archive/email attachment filenames.
Avoid exposing customer-specific values in documentation samples.
Joins values into a comma-separated string.
var values = ["One", "Two", "Three"];
CurrentText = values.join(", ");Use when collecting repeated values into one display field.
Do not use if each value must remain a separate JobInfo.
Converts null or undefined CurrentText to an empty string.
CurrentText = (CurrentText == null) ? "" : "" + CurrentText;Use before trim, replace, or lowercase operations.
This intentionally converts numbers to strings.
Phase 5 adds related-topic guidance to reduce duplicate entries and make reusable patterns easier to find.