Dynamics 365 for Sales Execute

On this Page

Overview

This Snap calls the MS Dynamics 365 For Sales REST WebAPI endpoint using the incoming data and writes out a JSON response.

ETL Transformations & Data Flow

This Snap enables the following ETL operations or flows:

  • Extract data from the upstream Snap containing the data for performing the provided action on the MS Dynamics 365 For Sales object(s).
  • Transform the input document into a SnapLogic-friendly JSON Document.
  • Load the data into the Dynamics 365 For Sales Execute Snap to perform the operation on the MS Dynamics 365 For Sales object(s).

Input & Output

  • Expected upstream Snaps: Any Snap, such as a Mapper or JSON Generator Snap, that offers a document as output. 

  • Expected downstream Snaps: None.

  • Expected Input: The mandatory fields required for executing the concerned operation on the MS Dynamics 365 For Sales object(s).

  • Expected Output: A document with the result set. If the operation is successful, then the output document will contain the information on the MS Dynamics 365 For Sales object(s) being operated.

Prerequisites

You must have a Dynamics 365 OAuth2 for Online account, data to query, and access to the objects concerned.

Configuring Accounts

This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See Configuring Dynamics 365 for Sales Accounts for information on setting up this type of account.

Configuring Views

Input

This Snap has exactly one document input view.
OutputThis Snap has exactly one document output view.
ErrorThis Snap has at most one document error view.

Troubleshooting

To check whether an operation has completed as expected, perform the same operation directly on the user interface or by sending the appropriate JSON request to the MS Dynamics 365 For Sales WebAPI endpoint. Use Postman (version 6.0.10 minimum) and collect the necessary data. To see if there are any inconsistencies, compare the data used in the user interface or Soap UI with the SnapLogic pipelines.

Support

Known Issues

  • The Execute Snap currently does not fetch schema. Currently, the user is expected to completely craft the upstream request body.

Snap Settings


LabelRequired. The name for the Snap. Modify this to be more specific, especially if there are more than one of the same Snap in the pipeline.
Dynamics Organization URL

Required. The URL for the MS Dynamics 365 For Sales WebAPI endpoint.  Although the URL is editable, query parameters should not be placed within the URL, as that will not work with the supporting libraries. The Query Parameter fields must be explicitly-used query parameter values, such as search filters, etc.

This field is suggestible, and shows the user's currently configured Account URL. The REST resource, etc. can be then crafted onto the resulting URL.

Example: https://abcxyzcompany.api.crm.dynamics.com/api/data/v8.2/

Example: https://abcxyzcompany.api.crm.dynamics.com/api/data/v8.2/accounts(GUID)  (For example, in a GET request of a specific account)

Default value: https://<organization>/api/data/<version>/<api>


Object type
Enables you to specify the MS Dynamics 365 for Sales object type to allow its schema to be fetched by the Snap. Custom object types are currently not supported.
Default value: account

HTTP Method

Required. The HTTP REST Method that will be used in the request.

Example: GET, POST, PUT, PATCH, DELETE

Default value: GET


HTTP Request Body

The request body can be directly input into this field for write actions, such as POST or PATCH; however, this field is not required for actions such as GET or DELETE.  If the request body is input directly into this field, it must be in the form of a JSON String.  Note that the double quotes in the String need to be "Java escaped".

Typically the request body will be provided by an upstream Snap such as a Mapper Snap or JSON Generator Snap.  Therefore, the field is defaulted to being expression enabled, and the expression is set to "$" which represents the JSON body provided by the upstream Snap.

Example:


Default value: $


Query ParametersUse the Query Parameters field-set to define search query parameters and their values. The query parameters will be attached to the URL using the HTTP query parameter syntax, separated by '&' and added as key=value.
HTTP header

Additional HTTP headers to pass when sending requests to the Dynamics 365 for Sales instance.

Example:

Key

 Value
Prefer odata.include-annotations="*"

Default value: No default value


Parameter

Enter here the attribute that would be used as a key in your query.

Example: $filter: A value of $filter is typically used as part of a GET request. For example, the user may want to GET Account objects where a given filter condition exists.  Microsoft Dynamics 365 provides a number of special functions that accept parameters, return Boolean values, and can be used as filter criteria in a query. For a list of these functions, see Microsoft Web API Query Function Reference

The following is an example of the Between Function searching for accounts with a number of employees between 5 and 2000:


Value

Specify the value associated with the parameter chosen in the Parameter field in the Query Parameters field-set.

For example, if the Parameter was $filter, the value could be '"name eq 'Microsoft'  or 'revenue gt 100' or "address1_fax eq '1234567'".

When specifying a value that is a string (name or address1_fax), the value must be encased in single quotes. If the value is truly a number, as in the example: 'revenue gt 100', the value must not be encased in single quotes.


Microsoft has provided the following documentation on the filtering functionality:

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/query-data-web-api#filter-results


Snap Execution

Select one of the three modes in which the Snap executes. Available options are:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.
  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.


Examples


Using Dynamics 365 for Sales Execute as a Standalone Snap

Basic use case: Retrieving an organization's account information

 Retrieving an organization's account information

This pipeline demonstrates how the Execute Snap functions as a standalone Snap in a pipeline. 

In this example, we shall retrieve all the Accounts present in the MS Dynamics 365 For Sales Org:

The Execute Snap's configuration is the following:

Download the sample pipeline

Using Upstream Snaps with the Execute Snap


Basic Use Case: Creating an account using the Execute Snap

 Creating an account using the Execute Snap

The following pipeline demonstrates how you can use the Execute Snap to create an Account.

In this example, we have used a JSON Generator Snap to capture the details we want to use to create an account. This is the JSON document provided by the generator:


We now add an Execute Snap downstream to the JSON Generator.

Two configurations to be made here:

  • Once you have entered–or selected the Dynamics Organization URL from the drop-down list, you need to append the word 'accounts' to the URL, as shown in the screenshot above.
  • Select the HTTP Method as POST.

Save and close the Snap Settings popup and execute the pipeline.

For a successful execution, you should see JSON output similar to the one shown below:

Download the sample pipeline

Advanced Use Case: Querying an account using query parameters within the Execute Snap

 Querying an account using query parameters within the Execute Snap

The following pipeline demonstrates how you can implement a filter the Execute Snap's query parameters to retrieve a specific Account.


In this example, we have used a Mapper Snap to pass the value we are searching for into the name variable.

Now we craft the query parameter key and value pair in the Execute Snap. Note:  In order to follow MS Dynamics 365 For Sales guidelines, we have to surround our "$name" variable with single quotes.  This is because the "$name" variable is going to be evaluated by Microsoft as a string of characters.  If we had been evaluating a numeric value such as a dollar amount, we would not surround the variable in single quotes.  Note that there are some values that are entirely full of numeric characters, but are in fact strings (phone numbers, fax numbers, etc). Microsoft has provided the following detailed information regarding the use of "$filter" queries : Query Data using the Web API.


Now we see that we were able to successfully execute the request, and have indeed retrieved the account with the specified "$name" variable:

Download the sample pipeline

Downloads

  File Modified

File MSD365_Execute_Get_AccountsinOrg.slp

Jul 27, 2018 by Rakesh Chaudhary

File MSD365_Execute_Create_Account.slp

Jul 27, 2018 by Rakesh Chaudhary

File MSD365_Execute_QueryAccount.slp

Jul 27, 2018 by Rakesh Chaudhary

Snap Pack History

 Click to view/expand
ReleaseSnap Pack VersionDateTypeUpdates
4.27main12833 StableUpgraded with the latest SnapLogic Platform release.
4.26main11181 StableUpgraded with the latest SnapLogic Platform release.
4.25 Patch425patches10303 LatestFixed an error in Dynamics 365 for Sales Create Snap where the Snap does not send the original documents to the error view in the output when the batch size property is set to greater than 1.
4.25main9554
 
StableUpgraded with the latest SnapLogic Platform release.
4.24main8556
StableUpgraded with the latest SnapLogic Platform release.
4.23main7430
 
StableUpgraded with the latest SnapLogic Platform release.
4.22main6403
 
StableUpgraded with the latest SnapLogic Platform release.
4.21 Patch dynamics365forsales8856 Latest

Fixes Pipeline validation error that occurs when writing data from Dynamics 365 for Sales Update Snap to output documents.

4.21snapsmrc542

 

StableUpgraded with the latest SnapLogic Platform release.
4.20snapsmrc535
 
StableUpgraded with the latest SnapLogic Platform release.
4.19 Patchexpensify8335 Latest

Fixed the broken doc link for the Expensify Export Report Snap.

4.19snaprsmrc528
 
StableUpgraded with the latest SnapLogic Platform release.
4.18 Patch dynamics365forsales7957 Latest
  • Fixed a NullPointerException issue with the Dynamics 365 for Sales Delete Snap wherein the Object ID is invalid.
  • Fixed a concurrency issue with multiple Dynamics 365 for Sales Snaps when running in parallel.
4.18 Patch dynamics365forsales7952 Latest

Added support for lookup type in the input document to be formatted per MS Dynamics 365 for Sales syntax.

4.18snapsmrc523
 
StableUpgraded with the latest SnapLogic Platform release.
4.17ALL7402
 
Latest

Pushed automatic rebuild of the latest version of each Snap Pack to SnapLogic UAT and Elastic servers.

4.17snapsmrc515
 
Latest

Added the Snap Execution field to all Standard-mode Snaps. In some Snaps, this field replaces the existing Execute during preview check box.

4.16 Patch dynamics365forsales7232 Latest

Dynamics 365 for Sales Read Snap now supports custom object types. 

4.16snapsmrc508
 
StableUpgraded with the latest SnapLogic Platform release.
4.15snapsmrc500
 
StableUpgraded with the latest SnapLogic Platform release.
4.14snapsmrc490
 
Stable
  • New Snap Pack: MS Dynamics 365 for Sales Snap Pack introduced in this release with the following Snaps:
    • Create
    • Delete
    • Execute
    • Read
    • Search
    • Update
    • Upsert