Generate a summary log after processing records in Jitterbit Studio
Introduction
Batch processing integrations run unattended and can process thousands of records in a single operation. Without a post-run summary, operators must read through raw operation logs to understand what was processed, what succeeded, and what failed. A summary log solves this by collecting one human-readable result line per record during processing, then delivering the completed log as a file or email when the operation finishes.
This pattern uses a global variable, summary_log, to accumulate result lines during a transformation. When processing is complete, a chained script operation writes the summary using WriteFile and sends it using SendEmailMessage. This guide extends the pattern described in Send an email notification from a Studio operation, which covers creating and configuring email notification components.
Design pattern
The pattern uses two operations in a chain:
- Processing operation: Source activity → Transformation → Target activity. A script in the transformation root node appends one result line per record to the
summary_logglobal variable. - Summary script operation (run on success): Reads
summary_logand callsWriteFileto persist the log,SendEmailMessageto deliver it, or both.
Global variables persist for the lifetime of an operation chain. summary_log is written by the transformation and is still in scope when the chained summary script runs, with no extra wiring required.
Part 1: Accumulate result lines in the transformation
-
In Studio, open your project and open the transformation used in your processing operation.
-
Select the root node of the transformation (the top-level source instance node), then open the formula editor for that node.
-
Add a script that appends one result line to
summary_logfor each record. The script should return a value that can be used by the transformation. Usetrueto ensure all records are processed:// Append a result line for this record $summary_log = $summary_log + Source.record_id + " | " + Source.name + " | processed\n"; // Increment the record count $summary_count = $summary_count + 1; // Return true so the transformation processes every record true;Replace
Source.record_idandSource.namewith the actual field names from your source schema.Note
summary_logstarts asnull. Jitterbit Script treatsnullas an empty string in string concatenation, so no explicit initialization is required before the first record is appended. -
To include a header line with the run date and total record count, add a separate initialization script to the operation that runs before the transformation, or prepend the header in the summary script operation after processing is complete.
Tip
Store the header separately in
summary_headerso it can be assembled after all records are processed, whensummary_counthas its final value:$summary_header = "Run: " + Now() + " | Records: " + $summary_count + "\n\n";
Part 2: Chain the summary script operation
-
On the design canvas, right-click the operation and select Settings to open the operation settings.
-
Select the Actions tab.
-
Condition: Select On Success.
-
Action: Select Run Operation.
-
Operation: Select or create a script operation that will write and send the summary. If the operation does not exist yet, create a new script operation, then return to this settings dialog to select it.
-
Click Add Action, then save the settings.
The summary script operation now runs automatically after the processing operation completes successfully.
Part 3: Write the summary to a file
In the summary script operation, call WriteFile to write summary_log to a file target activity:
// Assemble the full log with header and body
fullLog = $summary_header + $summary_log;
// Write to the file target activity
WriteFile("<TAG>activity:target:Summary Log File</TAG>", fullLog);
Replace Summary Log File with the name of your file target activity as it appears in the project.
Note
WriteFile is a Jitterbit Script function, not a file connector step. It writes content to a file target activity already configured in the project. Configure the target activity with the destination path and filename before calling WriteFile.
Tip
Include the run date in the filename to avoid overwriting previous logs. Configure a project variable such as [run_date] in the target activity's filename path (for example, summary_[run_date].txt), and populate $run_date in your script before calling WriteFile:
$run_date = Format(Now(), "yyyy-MM-dd");
WriteFile("<TAG>activity:target:Summary Log File</TAG>", fullLog);
Part 4: Send the summary as an email
-
Create an email notification component that will carry the summary. For full setup instructions, see Send an email notification from a Studio operation.
-
In the Subject field of the notification, reference
summary_countto include the record total:Processing complete: $summary_count records -
In the Message field, reference
summary_logto include the accumulated result lines:$summary_header$summary_logGlobal variables are resolved at send time, so the message body reflects the values set during the processing run.
-
In the summary script operation, call
SendEmailMessageafterWriteFile(if used):SendEmailMessage("<TAG>email:Processing Summary</TAG>");Replace
Processing Summarywith the name of your email notification component.
Verify the integration
-
Deploy and run the processing operation against a small test dataset of two or three records.
-
In the operation logs, confirm that the processing operation completed without errors and that the summary script operation ran on success.
-
If you configured
WriteFile: check the target file activity's destination path and confirm the summary file was created. Open it and verify that it contains one result line per record plus the header. -
If you configured
SendEmailMessage: check the recipient inbox and confirm the email arrived with the expected subject and body content. -
If the email body or file content is empty, confirm that the accumulation script is placed on the transformation root node (not in a separate script operation) so that it runs once per record during the transformation.
-
If the summary script operation does not run, confirm that the On Success action is attached to the processing operation, not to a parent or child operation in the chain. Check the operation logs to see whether the success condition fired.
-
If
WriteFilereturns an error, confirm that the file target activity is configured correctly and that the agent has write access to the destination path.