Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this Page

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

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 AccountAccounts 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:

Paste code macro
 
"{\"name\" : \"Microsoft\"}"


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:

Paste code macro
 
filter=Microsoft.Dynamics.CRM.Between(PropertyName='numberofemployees',PropertyValues=["5","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'".

Note

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


Multiexcerpt include macro
nameSnap Execution
pageSOAP Execute

Multiexcerpt include macro
nameExecution_Detail_Write
pageSOAP Execute



Examples


Using Dynamics 365 for Sales Execute as a Standalone Snap

Basic use case: Retrieving an organization's account information

Expand
titleRetrieving 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

Expand
titleCreating 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

Expand
titleQuerying 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.

Image Modified

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

Image Modified

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 : Dynamics Docs > Query Data using the Web API > Filter results.

Image Modified

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

Image Modified

Download the sample pipeline


Downloads

Attachments
uploadfalse
oldfalse
patterns*.slp,*.zip

Insert excerpt
MS Dynamics 365 for Sales Snap Pack
MS Dynamics 365 for Sales Snap Pack
nopaneltrue