Skip to content


Using Global Variables with the Run Integration Tasks

By combining global variables with chaining integrations together, users can pass data to the next integration – either to be used in the data source of the second integration, or as part of the additional columns.

One common scenario is where a transaction (i.e., an invoice) is being generated in Dynamics CRM/CE and sent to the financial system. In this example, we’ll use Dynamics 365 Business Central. When the invoice is sent across, we want to record the CRM invoice number or name in Business Central, but then also send the generated number from BC back to CRM.

We’ll accomplish this using 2 integrations, 1 global variable, and the Run Integration Task. We’ll use a real-time integration to send the invoice from CRM to BC, and we’ll be sending the Invoice Name field to the Your Reference field in BC on the invoice. This determines how/what we use our global variable to track.

Global Variable

First, we’ll create a global variable that is named to represent the data we will be storing in it. In this example, this is the Invoice Name being sent to the Your Reference field. This can be done in the Maintenance section of SmartConnect.

We will need to store the Invoice Name value in a global variable so we can reference it in the data source of the second integration in order to write back the document number to CRM that BC generated for our invoice. This can be set in the Restriction of the first integration, since we have the data being passed through and we are dealing with just one record at a time.

We now can save that integration and start looking at the integration that will be writing the data back to CRM. In this case, we’ll be using a bulk source to pull the data from BC but adding the global variable that we are passing through to restrict it to the one specific record we just created. The source query would look similar to the following, where we query the invoice service from BC but add the filter to it:

That data source should then be attached to the integration that will be writing the data back to CRM. In this scenario, the integration will simply be using the Your Reference field as the key/grouping field when sending back to CRM, and then writing the “No” (Document Number) field from BC to a field that will hold it in CRM. That mapping should be created, and the overall integration saved before continuing.

Run Integration Task

The final step is to tie the 2 integrations together using the Run Integration task. Opening the original real-time integration from CRM to BC and navigating to the Tasks menu allows it to be created. In the task, the option for “Use Parent Variables” should be selected.

Once that task is configured and saved, the process should be complete. Anytime the real-time integration sends a new invoice to BC from CRM, the global variable and task will ensure that the second integration immediately runs afterward and sends the BC document number back to CRM because of the global variable filtering it down to just the one record.

This concept can be used for any other integrations that are similar to the scenario above. It is important to remember though that real-time integrations are best for using global variables in this manner, since it is only one record at a time which allows the global variable to be set and passed through for the data.

If you have any questions about using global variables or SmartConnect, feel free to reach out to us at

Leave a Comment


Accessing Your Historical Dynamics NAV Data in D365 Business Central - Part 1: Getting Started
eOne Welcomes Incremental Group as a New eOne iPaaS Integration Partner
Employee Spotlight: Floyd Jones, Front End Developer
NEW WEBINAR: Popdock Onboarding - Fall in Love with Your Data
Employee Spotlight: Calum McGrath, Implementation Consultant


2016 SmartConnect Integration Bootcamps
Tech Tues: Automatically refreshing Pivot Tables in Excel Refreshable Reports
Happy Thanksgiving from the eOne team!
2017 SmartConnect Integration Bootcamps
New Releases of Extender and SmartList Builder



Business Central CRM D365 Business Central Dynamics 365 dynamics crm Dynamics GP Dynamics NAV Econnect Employee Spotlight eone eOne News error Error Message Events Excel Excel Report Builder Extender Flexicoder GP integration Map Meet the Team Microsoft dynamics crm Microsoft Dynamics GP Navigation List Builder Office Relationships Partner All Hands Call Popdock promotions release SalesForce SmartConnect SmartConnect Bootcamp SmartConnect Maps SmartConnect Office Hours SmartList SmartList Builder SmartPost SmartView SQL Tech Tuesday Templates training

Integrate & Automate without Any Code.

SmartList Data has Never Been Faster.

The Easiest Way to Report on GP Data.