Workday and SAP Worker (Employee) Aggregation

(0 reviews)


Collects and merges workers from Workday and employees from SAP into a CSV file. You can modify this basic pattern to collect from more or different sources and to produce formats other than CSV.

You can trigger this manually or programmatically with an HTTP call. Workers are sorted such that the ones only in Workday appear first, followed by the ones only in SAP, and lastly by the ones found in both systems. The custom sort or merge logic can be easily modified to present the data as needed. This template also serves as a base for building APIs using the Anypoint Platform.

Aggregation templates can be easily extended to return a multitude of data in mobile friendly form to power your mobile initiatives by providing easily consumable data structures from otherwise complex backend systems.


License Agreement

This template is subject to the conditions of the MuleSoft License Agreement. Review the terms of the license before downloading and using this template. You can use this template for free with the Mule Enterprise Edition, CloudHub, or as a trial in Anypoint Studio.

Use Case

As a SAP admin I want to aggregate workers from Workday and employees from SAP and compare them to see which workers can only be found in one of the two and which workers are in both instances.

For practical purposes this template generates the result in the format of a CSV report sent by email.

This template serves as a foundation for extracting data from two systems, aggregating data, comparing values of fields for the objects, and generating a report on the differences.

As implemented, it gets workers from Workday and employees from SAP, compares by the email address of the workers and employees, and generates a CSV file which shows workers in Workday, employees in SAP. The report is then emailed to a configured group of email addresses.


To make this template run, there are certain preconditions that must be considered. All of them deal with the preparations in both, that must be made for the template to run smoothly. Failing to do so can lead to unexpected behavior of the template.

Before continuing to use this template, see the SAP connector guide to work with SAP and Anypoint Studio.


This Anypoint template uses a few private Maven dependencies from MuleSoft to work. If you intend to run this template with Maven support, you need to add three extra dependencies for SAP to the pom.xml. See SAP XML and Maven Support.

SAP Considerations

Here's what you need to know to get this template to work with SAP.

As a Data Destination

There are no considerations with using SAP as a data destination.

Workday Considerations

As a Data Source

The Workday connector currently does not support autopaging functionality out of the box so number of processed objects are limited to the connector's single page size.

Run it!

Simple steps to get this template running.

Running On Premises

Complete all properties in one of the property files, for example in and run your app with the corresponding environment variable to use it. To follow the example, use mule.env=prod.

After this to trigger the use case, browse to the local HTTP endpoint with the port you configured in your file. If this is, for instance, 9090 then you should browse to: http://localhost:9090/generatereport. The final report in CSV format is sent to email addresses that you configure in mule.*.properties file.

Where to Download Anypoint Studio and the Mule Runtime

If you are new to Mule, download this software:

Note: Anypoint Studio requires JDK 8.

Importing a Template into Studio

In Studio, click the Exchange X icon in the upper left of the taskbar, log in with your Anypoint Platform credentials, search for the template, and click Open.

Running on Studio

After you import your template into Anypoint Studio, follow these steps to run it:

  1. Locate the properties file, in src/main/resources.
  2. Complete all the properties required per the examples in the "Properties to Configure" section.
  3. Right click the template project folder.
  4. Hover your mouse over Run as.
  5. Click Mule Application (configure).
  6. Inside the dialog, select Environment and set the variable mule.env to the value dev.
  7. Click Run.

Running on Mule Standalone

Update the properties in one of the property files, for example in, and run your app with a corresponding environment variable. In this example, use mule.env=prod.

Running on CloudHub

When creating your application in CloudHub, go to Runtime Manager > Manage Application > Properties to set the environment variables listed in "Properties to Configure" as well as the mule.env value.

Once your app is all set and started, supposing you choose as domain name workdayworkersaggregation to trigger the use case you just need to browse to The final report in CSV format is sent to email addresses that you configure in mule.*.properties file.

Deploying a Template in CloudHub

In Studio, right click your project name in Package Explorer and select Anypoint Platform > Deploy on CloudHub.

Properties to Configure

To use this template, configure properties such as credentials, configurations, etc.) in the properties file or in CloudHub from Runtime Manager > Manage Application > Properties. The sections that follow list example values.

Application Configuration

Application Configuration
  • http.port 9090
Workday Connector Configuration
  • wday.username bob.dylan@orga
  • wday.tenant org457
  • wday.password DylanPassword123

SAP Connector Configuration

  • sap.jco.ashost
  • sap.jco.user SAP_USER
  • sap.jco.passwd SAP_PASS
  • sap.jco.sysnr 14
  • sap.jco.client 800
  • sap.jco.lang EN
SMTP Services Configuration
  • smtp.port 587
  • smtp.user
  • smtp.password ExamplePassword456
Email Details
  • mail.from
  • mail.subject Employee Report
  • mail.body Please find attached your Employee Report
  • WorkersEmployeesReport.csv

API Calls

There are no special considerations regarding API calls.

Customize It!

This brief guide provides a high level understanding of how this template is built and how you can change it according to your needs. As Mule applications are based on XML files, this page describes the XML files used with this template. More files are available such as test classes and Mule application files, but to keep it simple, we focus on these XML files:

  • config.xml
  • businessLogic.xml
  • endpoints.xml
  • errorHandling.xml


This file provides the configuration for connectors and configuration properties. Only change this file to make core changes to the connector processing logic. Otherwise, all parameters that can be modified should instead be in a properties file, which is the recommended place to make changes.


The functional aspects of this template are implemented in this XML file, directed by a flow responsible for conducting the aggregation of data, comparing records, and finally formatting the output, in this case being a report.
This template uses the Scatter-Gather component to query the data in different systems. After that the aggregation is implemented in a DataWeave 2 script using the Transform component.

Aggregated results are sorted by source of existence:

  1. Workers only in Workday.
  2. Employees only in SAP.
  3. Workers and Employees in both Workday and SAP and transformed to CSV format. The final report in CSV format is sent to email addresses that you configure in mule.*.properties file.


This file provides the endpoint to start the aggregation. This template has an HTTP Listener as the way to trigger the use case.

Trigger Flow

HTTP Inbound Endpoint - Start Report Generation

  • ${http.port} is set as a property to be defined either on a property file or in CloudHub environment variables.
  • The path configured by default is generatereport and you are free to change for the one you prefer.
  • The host name for all endpoints in your CloudHub configuration should be defined as localhost. CloudHub routes requests from your application domain URL to the endpoint.


This file handles how your integration reacts depending on the different exceptions. This file provides error handling that is referenced by the main flow in the business logic.


Published by
MuleSoft Organization
Published onNov 14, 2018
Asset overview

Asset versions for 2.1.x

Asset versions


AggregationNo values left to add
EmployeeWorkerNo values left to add
WorkdaySAPNo values left to add
Enterprise ITNo values left to add