Taking Probes from Common Data Services

Table of Contents

This article shows you how to take a probe from Microsoft Common Data Services (CDS)  that are the foundation of PowerApps and Dynamics.

As preparation you need to create a CDS datasource first.

The common data services probe an OData based API where BiG EVAL is capable of connecting to by entering an OData-Query. You can find more information about OData-Queries with Common Data Services in Microsofts API Documentation.

You should note that the API returns a comprehensive JSON-document with either a single object or a list (array) of objects you queried. Each object may contain sub-objects or related objects. So the response of the API is a full graph ob objects. This doesn’t match BiG EVAL’s requirements for the test-algorithms. They need either a scalar value, a list of values or a table. Therefore we need to convert the API response into the format needed. This is done by the Extraction which can be configured within the probe. The extraction is a C#-based script that transforms the JSON-document to a list of values. The example below will give you an idea how to do that.

  1. Create a new probe in a BiG EVAL test.
  2. Choose your CDS datasource as the source of your probe.
  3. Enter the OData-query including all attributes. Please that only that part of the URL-path is needed, that follows the API-Version-number. E.g. accounts and not the full path /api/data/v9.1/accounts.
    The following example queries a list of all accounts with the attributes accountID (implicitly included) and the name of the account:
    accounts?$select=name
  4. Enter the extraction script. The following extraction-script returns a list of objects with attributes “AccountID” and “Name” so it can be used by BiG EVAL later on.
return ((IEnumerable<dynamic>)Response.value)
.Select(item =>
    new
    {
        AccountId = (Guid)item.accountid,
        Name = item.name.ToString()
    })
    .ToList();
  1. Enter 0 into the “identity column names” to mark the first column (=AccountId) as the primary key.
  2. Validate the probe.