Part 3 – Connecting Dynamics with Blockchain

Manny Grewal

If you have been following along the blog series, you’ve seen in Part 1 why blockchain matters and in Part2 how we can build a shopping cart in ReactJs that will be used in this part to send our transactions to the blockchain. In this part, we will see the blockchain plumbing and setup.

Audience: If you are functional consultant or an architect who wants to understand how blockchain transactions work (at a high level). I have explained them in the Blockchain Request Lifecycle section. If you are developer who would like to build something similar, I have also posted the source code of my working prototype that demonstrates how Dynamics can be linked to the blockchain. I have never heard of blockchain in Dynamics365 space, so potentially this the first ever working prototype with source code – hooray!!

There are few blockchains in the market but the two…

View original post 809 more words

Advertisements

Blockchain Part 2 – ReactJs portal for Dynamics 365

Manny Grewal

Continuing our journey down the chain as you can see in the architecture diagram I shared in my previous post NodeJs (the green patch) is our middleware that makes the commuicaiton possible. As of now Dynamics offers no direct connection to any blockchain. Let alone direct connection, there are not even any connector available. See that’s the joy of working on the cutting edge – you get to invent. Necessity is the mother of invention. So I thought of building some kind of middleware and NodeJs was a great choice as it will broker the communication between Dynamics, Portal and the blockchain.

The following are the main roles of the NodeJs layer in this architecture

Retrieving and storing information into Dynamics using Web API

For this I had to register my application inside the Azure AD as a native app.

Module Bundling

I used Webpack 3.0 as my module bundler…

View original post 611 more words

Blockchain integration with Dynamics 365

Manny Grewal

“2017 is the year of Machine Learning, 2018 will be the year of Blockchain. So get ready to chain your CRM to the block”

Manny Grewal

What a great way to start a blog series with a quote of your own. Last year I blogged at length how machine learning can take your CRM implementations to the next level and demonstrated some real world use cases of how artificial intelligence can weave its magic. This year I thought why not explore the other great things buzzing around and the exploration left me amazed!!  Not because I learnt lot of amazing things but at the amount of untapped potential which we are missing upon. Technology paradigms are changing rapidly and being a technologist feels like running after multiple buses departing away from you in opposing directions. If you run after one, you’ll miss the other.

 

This is what happened when…

View original post 616 more words

How to capture photo and update in Dynamics 365 for Phones App using Javascript CRM Online V9.X?

captureImage invokes the device camera to capture an image

Syntax:

Xrm.Device.captureImage(imageOptions).then(successCallback, errorCallback)

Parameters:

Parameter Name Type Required Description
imageOptions Object No An object with the following attributes: – allowEdit: Indicates whether to edit the image before saving. Boolean. – height: Height of the image to capture. Number. – preferFrontCamera: Indicates whether to capture image using the front camera of the device. Boolean. – quality: Quality of the image file in percentage. Number. – width: Width of the image to capture. Number..
successCallback Function Yes A function to call when image is returned. A base64 encoded image object with the following attributes is passed to the function: – fileContent: Contents of the image file. String – fileName: Name of the image file. String. – fileSize: Size of the image file in KB. Number. – mimeType: Image file MIME type. String.
errorCallback Function Yes A function to call when the operation fails.

Return Value:

On success, returns a base64 encoded image object with the attributes specified earlier.

Note: This method is supported only for the mobile clients. (Dynamics 365 for Phones App in Tablet and Mobiles)

Example:

Capture Photo button is created on Account form and OnClick of the button below function CaptureImage configured.

function CaptureImage() {
 Xrm.Device.captureImage().then(
 function success(result) {
 // Update Image
 updateImage(Xrm.Page.data.entity.getId(), result.fileContent);
 },
 function (error) {
 // Show Error
 Xrm.Utility.alertDialog("Error :" + error.message, null);
 }
 );
}

// This function will update the Image to Account record
function UpdateImage(accountGuid, ImageContent) {
 // define the data to update a record
 var data =
 {
 "entityimage": ImageContent
 }
 // Update the record
 Xrm.WebApi.updateRecord("account", accountGuid, data).then(
 function success(result) {
 Xrm.Utility.alertDialog("Account Image updated", function () {
// Reload Account form to show the updated Image
 Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId());
 });
 },
 function (error) {
 Xrm.Utility.alertDialog("Error while updating Account Image : " + error.message, null);
 // handle error conditions
 }
 );
}

Output: 

1.Open Dynamics 365 for Phones App in Mobile or Tablet.

2.Navigate to Accounts and open any Account record.

3.Tap on Capture Photo button. System or Mobile Inbuilt Camera will be opened and click on Camera icon to capture the photo.

Capture Photo

4. Once photo is captured and saved, you will see the below message. Tap on OK to open the Account record to see the updated image.

Captured Image Updated Message

Hope you learned this new feature :):):)

Using Shared Mailbox and Queue in CRM for implementing generic email address in Dynamics 365 and Exchange Online.

Nishant Rana's Weblog

Recently, we had a requirement to send email to customers using a generic email address like donotreply@domain.com from Dynamics CRM (& Exchange Online).

The way we can implement this is through Shared Mailbox and Queue in CRM Online.

Log in to the Administration Portal

https://portal.office.com/adminportal/home#/homepage

Select Shared mailboxes

Members can be added to the Shared Mailbox

Now back in CRM assign the email id to a particular queue.

Now sending an email activity with From as Queue and to as one of the user inside CRM.

Open the user’s mail box.

Make sure we have done Test and Enabled Mailbox for the Shared Email Box and have set Incoming and Outgoing Email as Server-Side Synchronization.

Hope it helps..

View original post

How to get the Logged In User Security Role Names using JavaScript in Dynamics 365 V9.X?

Use the below code to get the Logged In User Security Role Names in Dynamics 365 V9.X,

JS Code:

function GetLoggedInUserSecurityRoleNames() {
 // Get Logged In User Context
 var userSettings = Xrm.Utility.getGlobalContext().userSettings;
 // Get Logged In User Security Roles
 var loggedInUsersecurityRolesGuidArray = userSettings.securityRoles;
 var totalSecurityRolesArray = new Array();
 var rolesOutputText = "";

if (loggedInUsersecurityRolesGuidArray.length > 0) {
 Xrm.WebApi.retrieveMultipleRecords("roles", "?$select=name,roleid").then(
 function success(result) {
 if (result.entities.length > 0) {
 // Push Role Names and Role Ids to Array
 for (var rolesCount = 0; rolesCount < result.entities.length; rolesCount++) {
 totalSecurityRolesArray.push({ RoleName: result.entities[rolesCount].name, RoleId: result.entities[rolesCount].roleid });
 }

rolesOutputText = userSettings.userName + " has the below Security Roles\n------------------------------------\n";

// Compare the User Security Roles with Total Security Roles
 for (var userSecurityRolesCounter = 0; userSecurityRolesCounter < loggedInUsersecurityRolesGuidArray.length; userSecurityRolesCounter++) {
 for (var totalsecurityRolesCounter = 0; totalsecurityRolesCounter < totalSecurityRolesArray.length; totalsecurityRolesCounter++) {
 if (totalSecurityRolesArray[totalsecurityRolesCounter].RoleId.toLowerCase() == loggedInUsersecurityRolesGuidArray[userSecurityRolesCounter].toLowerCase()) {
 rolesOutputText += totalSecurityRolesArray[totalsecurityRolesCounter].RoleName + "\n";
 break;
 }
 }
 }
 }

// Show User Roles
 Xrm.Utility.alertDialog(rolesOutputText, null);
 },
 function (error) {
 // Show error
 Xrm.Utility.alertDialog(error.message, null);
 });
 }
}

Output: Have configured the above function on Onload of Account and below is the output.

User Security Roles

Hope you got all the Security Role Names of the Logged In User :):):)