Advertisements

Archive

Author Archive

[PowerApps Portal (preview)] Build your first portal

PowerApps Portalsprovides ability to build low-code, responsive websites which allow external users to interact with the data stored in the Common Data Service.

Refer article for introduction. PowerApps Portals are in Preview now and lets see how to get started with a simple portal.

Perquisites:

Steps to build your first Portal:

  • Login to PowerApps maker Portal
  • Pick the right ‘Environment’. Refer ‘Notes’ section below to know more about ‘Environments’.
  • Click on ‘Portal from blank (preview)’ link.

PAPP_Portal_15

  • In the pop-up, fill ‘Name’, ‘Address’ and ‘Language’ and click ‘Create’.

PAPP_Portal_2

  • Portal provisioning takes time and you will be notified once done.

PAPP_Portal_5

  • Post provisioning, click on ‘Edit’ which will redirect you to Portal editor.

PAPP_Portal_16

  • You get pre configured ‘Home’ page and ‘Child Pages’.
  • To add a new Page,
    • Either click on ‘+New page’ from ribbon
    • Or Right Click , ‘Home’ and add a New Page.

PAPP_Portal_6

  • I have added a new ‘Accounts’ page and filled the details on the right side ‘Component’ panel.
  • To create a new ‘Account’ form, click on ‘Form’ and choose Entity, Form and Mode from the ‘Component’ panel.

PAPP_Portal_8

  • To add a new ‘Entity List’ control, click on ‘List’ and on the right hand side, select ‘Entity’ and ‘Views’
    • Note: In the screen below, I’ve added an existing ‘List’. The properties are same for new ‘List’ as well.

PAPP_Portal_7

  • To map the Account ‘Form’ with ‘List’, set properties as below

PAPP_Portal_9.PNG

  • At any point of time, to view the changes, click on  ‘Browse website’ on top right corner.
  • Home Screen

PAPP_Portal_13.PNG

  • Accounts Screen

PAPP_Portal_14

Notes:

  • To use the Dynamics CE entities, you have to select the CE ‘Environment’ in your maker portal, before the start of Portal creation.
    • A ‘default’ environment gets created by default. If you pick ‘default’ environment, you will need to create a new Environment with CDS database.

PAPP_Portal_17

PAPP_Portal_18

New Environment

  • We can still create Portal from the ‘Dynamics Admin Center’.

PAPP_Portal_3

  • PowerApps portal got ‘.powerappsportals.com’ as domain and regular portal will be of ‘.microsoftportals.com’ domain.

PAPP_Portal_4

  • You can still create/update portal components (i.e., Entity List, Forms, Web Templates) from Dynamics web application.
  • Clear cache using ‘/_service\about‘ is still available in PowerApps portal.

PAPP_Portal_10

🙂

 

 

Advertisements

Post a File and Data to SandBlast API using Postman and generate C# code

We got a requirement to use SandBlast Threat Extraction  process, for cleansing the files.

SandBlast Threat Extraction, is a solution by ‘Check Point’ company,  which removes exploitable content, including active content and embedded objects, reconstructs files to eliminate potential threats.

‘Threat Extraction’ Upload API, requires following parameters

  • Header
    • Authorization
    • Content-Type
  • Body
    • File Content
    • request (This is string)

If you notice, we need to pass ‘File’ as well as ‘Data’ to the API.

As of now, Sandblast doesn’t have a native .Net library to make API calls. So I’ve used Postman tool as a starting point for my development.

Below is the step-by-step, to pass ‘File’ and ‘Data’ in request ‘Body’, using Postman

  • Open Postman tool
  • Create a new ‘Request’

PM_2

  • Set the method as ‘Post’ and URL.
  • From the ‘Body’ tab, select ‘form-data’ option
  • To pass the ‘File’,  add a new ‘KEY’ of type ‘File’ and browse the file in ‘VALUE’ parameter.
  • To pass the ‘Data’, add a new ‘KEY’ of type ‘Text’ and set the ‘VALUE’

PM_1

Generate C# code from the Request:

  • Postman has an amazing feature to generate the code in your required language.
  • Click on ‘Code’ link and for C#, choose ‘C# (RestSharp)’ option.

PM_3

If anyone having struggling to use Sandblast API’s, post in comments section and I will address.

🙂

 

Categories: Misc Tags: , , ,

HTML & JScript – Read and Encode file

We got a requirement in ADX portal, to read and convert the file content to Base64String , which eventually will be submitted to an external API.

Below is the code snippet to read the File content, browsed using the HTML ‘File Upload’ control:

function readFileAsText(){
try {
// Read the browsed file from ‘File Upload’ control.
var fileToLoad = document.getElementById(“fileOE“).files[0];

var fileReader = new FileReader();
fileReader.onload = function (fileLoadedEvent) {
// Set the file content to variable
var textFromFileLoaded = fileLoadedEvent.target.result;
alert(“File Content – ” + textFromFileLoaded);

// Using ‘window.btoa’ encode the plain text to Base 64
var convertedString = window.btoa(unescape(encodeURIComponent(textFromFileLoaded)));
alert(“Base 64 content – ” + convertedString);
};

fileReader.readAsText(fileToLoad, “UTF-8”);
} catch (e) {
alert(“Error in readFileAsText(); Error – ” + e.description);
}
}

<body>
<label for=”fileOE”>Pick the file </label><br>
<input type=”file” id=”fileOE” />
<input type=”button” value=”Upload” onclick=”readFileAsText()” />
</body>

  • Execute the code and you will get output as below
jScript_1

File content as text

jScript_2

Encoded File Content (Base 64)

🙂

Categories: Misc Tags: , , , ,

Dynamics CE – Issue while updating ‘Annotation’ record using SDK

Other day, we encountered following error in our plug-in, which has the logic to retrieve and update the ‘objectid’ field (i.e., Associated record) of Annotation record.

‘new_myentity’ with ID XXX-XXXX-XXXX-XXX does not exists

Below is the plug-in code:

var entAnnotation=new Entity(“annotation”);
entAnnotation.Attributes[“objectid”] = new EntityReference(“new_myentity”,”{GUID}”);
crmService.Update(entAnnotation);

We are trying to update ‘objectid’ and from the error, its clear that Object ID (i.e.,GUID) of the ‘new_myentity’ entity does not exists in the application.

But we know that the GUID is of a valid ‘new_myentity’ entity, as that was retrieved using ‘Query Expression’ in previous plug-in statement.

Reason and Fix:

  • We must also set ‘objecttypecode’ field as the schema name of the ‘objectid’ of the Annotation record.
  • In our case, its ‘new_myentity’.
  • Below is the code of Annotation update setting ‘objecttypecode’ field.

var entAnnotation=new Entity(“annotation”);
entAnnotation.Attributes[“objectid”] = new EntityReference(“new_myentity“,”{GUID}”);
entAnnotation.Attributes[“objecttypecode”] = “new_myentity“;
crmService.Update(entAnnotation);

Issue was annoying and took sometime to troubleshoot and find the actual reason.

🙂

Office 365 Groups + Dynamics 365

In Dynamics 365 online, records can be owned by ‘Office 365 Groups’. Refer my previous article and following are quick notes.

  • The administrator can create Azure AD group teams that are associated to the Azure AD groups in each of the Customer Engagement and Common Data Service environments and assign a security role to these group teams.
  • When members of these group teams access these environments, their access rights are automatically granted based on the group team’s security role.

If you notice, to get the benefits of AAD group ownership, Users must have assigned ‘Dynamics 365 Customer Engagement Plan’ license.

What if the User don’t have ‘Dynamics 365 Customer Engagement Plan’ license. For example, when a sales team has a major opportunity requiring input from several people who don’t have access to Customer Engagement apps.

Office 365 Groups provides a single location to share documents, conversations, meetings, and notes.

Office 365 Groups can be enabled for any entity.

Install Office 365 Groups solution:

T9

  • Install ‘Office 365 Groups’ solution.

TG_8

Enable entities for Office 365 Groups:

  • Connect to your Dynamics instance.
  • Go to Settings -> Office 365 Groups
  • Add required entities.

T10

Create Office 365 Group:

  • Make sure users must have ‘Office online’ license and Mailbox configured.

T11

  • Create a Group and add the Users.

T12

  • Users get notifications in their Outlook web app
  • From Outlook, Users can click on ‘Discover’ to explore more available groups.

T13

  • Also a new SharePoint Sitemap collection gets created for each Group, which allows Users to share documents.

T14

Use Office 365 Groups from Dynamics App:

As we enabled ‘Office Groups’ for ‘Account’ entity

  • Open any account from Dynamics App.
  • From sitemap, click on ‘Office 365 Groups’
  • You can either ‘Create a new group’ or use an existing group.

TG_12

  • Once the configuration is completed, you can start Conversation and share documents which would be available for all members of the group.

T15

🙂

 

 

Working with Azure Active Directory (AAD) Groups in Dynamics Customer Engagement

July 6, 2019 1 comment

In Dynamics 365 online, along with ‘Owner’ and ‘Access’ type, following types have been introduced in ‘Teams’.

  • AAD Security Group
  • AAD Office Group

T1

With these new ‘Team Types’, records in Dynamics 365 can be owned by AAD Groups.

Lets understand what is Azure Active Directory (AAD) group and what’s the significance of making AAD group as owner of a Dynamics record.

  • The administrator can create Azure AD group teams that are associated to the Azure AD groups in each of the Customer Engagement and assign a security role to these group teams.
  • When members of these group teams access these environments, their access rights are automatically granted based on the group team’s security role.

Create AAD Group:

  • Make sure you have Office 365 account (Subscribe to 30 days trail here)
  • Connect to Microsoft 365 Admin Center using Office 365 credentials.
  • Create Users and assign ‘Dynamics 365 Customer Engagement Plan’ license.

T2

  • Now connect to Azure Active Directory Portal
  • Create a new Group of type ‘Office’ and add the Users.
  • Copy the ‘Object ID’ which we need in next steps.

T3

Create Team of type ‘AAD Office Group’:

  • Connect to Dynamics instance
  • Navigate to Settings -> Security -> Teams -> New
  • Select ‘Team Type’ as ‘AAD Office Group’ and paste the AAD Group ‘Object Id’ copied in above section.
  • Save and assign a role.

T4

Access the Dynamics as ‘AAD Group’ Team Member:

As we created a AAD Group and a Team in Dynamics App with ‘Sales Manager’ security role, it’s time for ‘Test User 1’ to access the Dynamics Application.

  • Login to Dynamics Application as ‘Test User 1’
  • Post login, Dynamics App greeted me with ‘You need a Microsoft Dynamics 365 security role to continue’ message.

T5

  • From the message, its clear that Dynamics App expecting ‘Test User 1’ to have a User level Security role and not honoring the Team level Security Role which he is member of.
  • We can resolve this issue by assigning ‘Sales Manager’ role to ‘Test User 1’ which means for every User of AAD group we have to on-board by assigning them an individual security role.
  • But we can make ‘Test User 1’ access Application with out assigning a Role, as we got a cool ‘Member’s privilege inheritance’ feature introduced in ‘Security Role’.

‘Member’s privilege inheritance’ in Security Role:

  • Navigate to ‘Settings -> Security -> Security Roles’
  • Open the ‘Sales Manager’ security role.
  • Change the ‘Member’s Privilege Inheritance’ to ‘Direct User (Basic) access level and Team privileges‘ and Save.

T6

  • Refresh the Dynamics application, ‘Test User 1’ can access the records and application.

T7

  • By setting ‘Member’s Privilege Inheritance’ to ‘Direct User (Basic) access level and Team privileges‘ makes the ‘Sales Manager’ role as both User role as well Team role.
  • This feature eliminates the need of AAD Admin to assign User level roles to individual group members.

Assign Records to ‘AAD Group’ Teams:

  • We can assign the record to ‘AAD Group’ Teams similar to ‘Owner’ Teams.

T8

🙂

 

 

D 365 Managed Solutions – Delete Components from target instance using ‘Stage for Upgrade’ option

Assume that you have exported and imported a Managed Solution ‘A’ from DEV to TEST. The solution ‘A’ has 2 entities (E1 and E2) and got imported to Test instance.

Now, because of a change in requirement, you no longer required E2 entity and need to delete that from TEST instance.

How would you delete E2 using Solutions approach?

With ‘Upgrade Solution’ behavior of ‘Managed Solution’ (Refer flow below), solution components only gets updated but not the deletion of the components.

Sol_12

And the answer to this is ‘Stage for Upgrade’ option of ‘Managed Solutions’.

Lets take following scenario to understand it better

  • DEV instance has an entity ‘Interest Rate’
  • Export a Managed solution with ‘Interest Rate’ entity from DEV and import to TEST.
  • Delete the ‘Interest Rate’ entity from DEV
  • Prepare a Managed solution and import to TEST using ‘Stage for Upgrade’ option.
  • ‘Interest Rate’ entity should get deleted from TEST

Below is my TEST instance which has managed solution by name ‘Loan Management’ got installed with ‘Interest Rate’ entity.

Sol_1

Steps to use ‘Stage for Upgrade’ option:

Below are the usage steps of ‘Stage for Upgrade’ option.

Export Solution from DEV:

  • Connect to the DEV instance and delete the ‘Interest Rate’ entity.

Sol_2

  • Increase the version number of the ‘Loan Management’ Solution and export as Managed Solution.

Sol_3

Import Solution to TEST:

  • Connect to TEST instance and click on ‘Import’ solution and make sure versions are different.

Sol_4

  • Click ‘Next’
  • Select ‘Stage for Upgrade’ checkbox and click ‘Import’

Sol_5

  • Up on successful import, As a last step, you would get ‘Apply Solution Upgrade’.

Sol_6

  • Don’t click the ‘Apply Solution Upgrade’ yet as we need to check few things.
    • Note: You can always click ‘Apply Solution Upgrade’ and complete the upgrade. I refrained to do as I want to explain more.
  • Close the ‘Import Solution’ wizard.
  • Now on TEST instance, go to Advanced Find -> Interest Rate and you will still get the entity and data. Which means the Upgrade hasn’t happen yet.

Sol_7

  • Lets complete the Upgrade by go to Settings -> Solutions and you will see 2 solutions
    • Solution with ‘_Upgrade’ is Stage solution.

Sol_8

  • Select the old solution (i.e., Solution with no ‘_Upgrade’) and click on ‘Apply Solution Upgrade’.

Sol_9

  • The process takes time and once completed you would see a single solution with increase in version.

Sol_10

  • Now, go to Advanced Find -> Interest Rate and you will not get the entity and data.

Sol_11

Refer this White Paper for more details on Solution Life Cycle Management.

🙂