Use CrmServiceClient to execute web request against Web API – Dynamics 365


In the previous post we saw how to use CrmServiceClient to connect to CDS using Authentication Type – OAuth and execute web request using Organization.svc service

https://nishantrana.me/2020/11/09/sample-code-to-connect-to-cds-dynamics-365-ce-using-oauth/

Here we will extend the same example to execute web request using Web API.

  • Create the contact record with first name and last name populated

using Microsoft.Xrm.Tooling.Connector;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;

namespace SampleConsoleApp
{
class Program
{
static void Main(string[] args)
{
string ConnectionString = "AuthType = OAuth; " +
"Username = [username]@[domain].onmicrosoft.com;" +
"Password = [password]; " +
"Url = https://[orgname].crm.dynamics.com;" +
"AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;" +
"RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;" +
"LoginPrompt=Auto";

CrmServiceClient svc = new CrmServiceClient(ConnectionString);

// specify OData Headers
Dictionary<string, List<string>> odataHeaders = new Dictionary<string, List<string>>
{
{ "Accept", new List<string>() { "application/json" } },
{ "OData-MaxVersion", new List<string>() { "4.0" } },
{ "OData-Version", new List<string>() { "4.0" } }
};

if (svc.IsReady)
{
// create a contact record with firstname and lastname populated
dynamic contact = new JObject();
contact.firstname = "Meeska";
contact.lastname = "Mooska";
string jsonContact = Newtonsoft.Json.JsonConvert.SerializeObject(contact);

// create the contact record
// Parameters - HttpMethod, QueryString, Body, Customer Headers, Content Type
HttpResponseMessage httpResponse = svc.ExecuteCrmWebRequest(
HttpMethod.Post,
"contacts",
jsonContact,
odataHeaders,
"application/json");

if (httpResponse.IsSuccessStatusCode)
{
var contactUri = httpResponse.Headers.GetValues("OData-EntityId").FirstOrDefault();
Console.WriteLine("Contact URI: {0}", contactUri);
}
else
{
Console.WriteLine(httpResponse.ReasonPhrase);
}
}
}
}
}

  • Retrieve first name and last name for all the contact

// retrieve first name and last name of all the contact records 
HttpResponseMessage httpResponse = svc.ExecuteCrmWebRequest(
HttpMethod.Get,
"contacts?$select=firstname,lastname",
string.Empty,
odataHeaders,
"application/json");

 

Get the details here – ExecuteCrmWebRequest

Hope it helps..

Power Apps | Microsoft Dataverse


Rajeev Pentyala - Microsoft power platform blog

Microsoft Dataverse

Common Data Service (CDS), the sophisticated and secure backbone that powers Dynamics 365 and Power Platform, has been renamed to Microsoft Dataverse

Some terminology in Microsoft Dataverse has been updated. For example, entity is now ‘Table’ and field is now ‘Column’.

Microsoft Dataverse for Teams

Microsoft Dataverse for Teams (formerly known as Project Oakdale), a low code built-in data platform for Teams, is generally available now.

Microsoft Dataverse for Teams follows existing data governance rules established by the Power Platform and enables access control in the Teams Admin Center like any other Teams feature. Within the Teams Admin center, you can allow or block apps created by users at the individual level, group level, or org level.

Refer my article on Project Oakdale to know more.

Power BI Teams App

Licensed Microsoft Power BI users can enjoy the full capabilities of Power BI in Teams with the Power…

View original post 38 more words

Date Time Behavior and Format in Power Platform/Dynamics 365 CRM


Prashant Kumar Maurya

Date Time field in power apps has behaviors and formats which control how the data will be stored in CDS (Common Data Service) and how it will pe presented to different users from different time zone on retrieval. Here I will try to explain the same in a simple way with examples for each combination of behaviors and formats.

Behavior: User Local

  1. Format: Date Only
    • User’s provided date gets converted to UTC before it gets saved in CDS.
    • As there is no time part in user input system will take midnight as input time for conversion.
    • Stored data in CDS will have both date and time part.
    • System will convert UTC time to requesting user’s time zone while displaying data in UI.
  2. Format: Date and Time
    • User’s provided date and time gets converted to UTC before it gets saved in CDS.
    • Stored data in CDS will have both date and…

View original post 473 more words

Create Reports (Power BI embedded) using Dynamics 365 Customer Insights


Virendra Agrawal's Blog

Recently, there was a new featured launched into Dynamics 365 Customer Insights to build reports within Customer Insights using the interactive custom report builder (Power BI embedded).

With this enhancement, we’ll be able to combine available metrics/measures and dimensions to create reports with the CI data , using the visualizations we want directly within Customer Insights. It will provide another way of generating the reports and visualise the Customer Insights data (without using the Power BI connector).

In this post, we’ll talk about how we can use the built-in report feature within Customer Insights.


View original post 245 more words

Process Optimization – Dynamics 365 CE / CRM / CDS SSIS Integration toolkit – KingswaySoft


Process Optimizations is a new feature added in the CDS / CRM Destination Component of KingswaySoft’s SSIS Integration Toolkit as part of November 2020 Release.

Check other posts on SSIS and Dynamics 365

https://nishantrana.me/2020/10/16/ssis-kingswaysoft-and-dynamics-365/

These options if enabled, will turn off or disable plugin, workflow, entity auditing during pre-execution temporarily, during the writing process, and will revert the changes to the original state after successful execution.

  • Tentatively Disable Relevant Plugins (if any)
  • Tentatively Disable Relevant Workflows (if any)
  • Tentatively Disable Relevant Auditing (if any)

Let us take a simple example to see it in action.

Here we have a simple data flow that creates contact records inside CDS using Data Spawner.

https://nishantrana.me/2020/05/26/using-data-spawner-component-ssis-to-generate-sample-data-in-dynamics-365/

Let us run the package and see the status of the plugin, workflow, and audit with regards to the contact entity.

As expected, we do not see any Audit records created for contact records creation.

We see an event where Audit is disabled and then enabled later for the contact entity, during the duration of package running and after its successful completion.

We can also see our workflow in status – Draft

In the case of Plugin, we didn’t see the step being disabled and it was still being triggered

As per the documentation –

Get the toolkit here

https://www.kingswaysoft.com/products/ssis-integration-toolkit-for-microsoft-dynamics-365

Hope it helps..

Embedding Canvas App in an Iframe inside Dynamics 365


Canvas App can be easily embedded in a web site using the Iframe.

Say e.g. we have the following Canvas App to be embedded inside Dashboard in Dynamics 365

Save the app and navigate to Details

We can copy the Web link or App ID.

The URL Format –

https://apps.powerapps.com/play/[appId]

The other parameter that can be used are

source, tenantid, screencolor and any additional parameters

e.g.

https://apps.powerapps.com/play/[appId]?source=iframe&screenColor=rgba(120,110,55,1)&param1=value&param2=value 2

  • Here we have embedded it inside an Iframe component within the Dashboard

Publish the change and navigate to the Dashboard, we can see our Canvas App.

If the application is using Azure Active Directory-based authentication, the user will not be asked to sign-in again, else the user will be asked to Sign-in and will be able to access the app if it is shared with them.

Here we have embedded it inside an ASP.NET page, and we are asked to Sign-in.

After successful sign-in

Get all the details here –

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/embed-apps-dev

Hope it help..