Skip to Content

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:

  1. Processing operation: Source activity → Transformation → Target activity. A script in the transformation root node appends one result line per record to the summary_log global variable.
  2. Summary script operation (run on success): Reads summary_log and calls WriteFile to persist the log, SendEmailMessage to 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

  1. In Studio, open your project and open the transformation used in your processing operation.

  2. Select the root node of the transformation (the top-level source instance node), then open the formula editor for that node.

  3. Add a script that appends one result line to summary_log for each record. The script should return a value that can be used by the transformation. Use true to 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_id and Source.name with the actual field names from your source schema.

    Note

    summary_log starts as null. Jitterbit Script treats null as an empty string in string concatenation, so no explicit initialization is required before the first record is appended.

  4. 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_header so it can be assembled after all records are processed, when summary_count has its final value:

    $summary_header = "Run: " + Now() + " | Records: " + $summary_count + "\n\n";
    

Part 2: Chain the summary script operation

  1. On the design canvas, right-click the operation and select Settings to open the operation settings.

  2. Select the Actions tab.

  3. Condition: Select On Success.

  4. Action: Select Run Operation.

  5. 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.

  6. 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

  1. Create an email notification component that will carry the summary. For full setup instructions, see Send an email notification from a Studio operation.

  2. In the Subject field of the notification, reference summary_count to include the record total:

    Processing complete: $summary_count records
    
  3. In the Message field, reference summary_log to include the accumulated result lines:

    $summary_header$summary_log
    

    Global variables are resolved at send time, so the message body reflects the values set during the processing run.

  4. In the summary script operation, call SendEmailMessage after WriteFile (if used):

    SendEmailMessage("<TAG>email:Processing Summary</TAG>");
    

    Replace Processing Summary with the name of your email notification component.

Verify the integration

  1. Deploy and run the processing operation against a small test dataset of two or three records.

  2. In the operation logs, confirm that the processing operation completed without errors and that the summary script operation ran on success.

  3. 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.

  4. If you configured SendEmailMessage: check the recipient inbox and confirm the email arrived with the expected subject and body content.

  5. 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.

  6. 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.

  7. If WriteFile returns an error, confirm that the file target activity is configured correctly and that the agent has write access to the destination path.