Activity Logging – Dynamics 365 Apps


Microsoft 365 Security and Compliance Center – provides easy access to the data and the tools to manage the compliance need of an organization, and also can be used to review the different data processing activities within Dynamics 365 Customer Engagement apps.

It required Microsoft 365 E3 or E5 subscription and is only available for Production environments.

The events logged are –

  • CRUD, Export to Excel, SDK Calls.
  • CRUM and backend activities performed by the support engineer.
  • Report – viewed, exported, multimedia assets shown in the Report

For this first Auditing needs to be enabled in the environment.

Navigate to Settings > Administration > System Settings > Auditing Tab

Navigate to Compliance Center

https://protection.office.com/

Search > Audit Search Log and
Turn on auditing.



To try the new experience within the Compliance center

https://compliance.microsoft.com/auditlogsearch?viewid=Search


After around 1 hour or so, the settings got enabled.


As specified Office 365 logs are being prepared, if we try searching we’d get blank results


Below are the list of Dynamics 365 and Power Apps activities that can be tracked


Around after 3 hours or so – we saw the results appearing.

Export has 2 options –

Save loaded results –

Download all results –

At the same time there we 51 records in Audit Summary View.

Apart from searching for an audit log, we can also define an audit retention policy as shown below

Get the sample files here –

https://drive.google.com/file/d/1akifraP1NCV-KgmA-8ROhm8r4h0tAcLi/view?usp=sharing

https://drive.google.com/file/d/1s_EbJ4hraDl6YEVUCMkOe6bQbXCJu_5-/view?usp=sharing

Get all the details here

https://docs.microsoft.com/en-gb/microsoft-365/compliance/search-the-audit-log-in-security-and-compliance?view=o365-worldwide

Hope it helps..

Advertisements

Check access to a record in Dynamics 365


Using the Check Box button in the command bar, the user can now check the privileges he has on the record.

It also provides the details on how he has that particular privileges on the record, either through Security Roles assigned directly or through the team user is part of or through the Hierarchy security.

To see it in action, open a record and select Check Access

E.g. the below user has Read, Write, Create, Delete, Append, Append To, Assign, Share rights on the contact record, assigned directly as he has the system administrator role.

The admin user can also use the User lookup to check the access of the other users.

Here the test user 1 has rights to the record through the security roles assigned to him directly and also through the team he is part of.

Get all the details here –

https://docs.microsoft.com/en-gb/powerapps/user/access-checker

Blog posts on 2021 Release Wave 1 – Dynamics 365

Hope it helps..

How to – Extract attachments from Notes in Dynamics 365 / Dataverse


There are different ways we can extract attachments from notes.

  • We can write an SSIS Package using the Premium Derived Column component of KingswaySoft

https://nishantrana.me/2020/11/09/extract-attachment-from-notes-in-dynamics-365-ce-cds-ssis-kingswaysoft/

  • XrmToolBox has a wonderful plugin – Bulk Attachment Manager

https://www.livingintech.com/2018/02/xrmtoolbox-bulk-attachment-manager.html

The tool can download attachments from both Note and Email, using note’s GUID as the folder name.

  • We can use SDK and write console app or tool.

https://github.com/microsoft/PowerApps-Samples/blob/master/cds/orgsvc/C%23/URDAttachment/URDAttachment/SampleProgram.cs

https://www.c-sharpcorner.com/article/downloading-notes-attachments-using-paginghis-artcile/

Or use the CRM SDK within the script component of SSIS if we are not using KingswaySoft’s CDS Component.

https://nishantrana.me/2020/10/19/connect-to-dynamics-365-through-script-component-ssis/

  • Attachment Downloader Tool

https://vishalgrade.com/2018/01/22/ms-crm-attachment-downloader/

https://github.com/vgrade/MSCRMAttachmentDownloader

We can update the tool as per our requirement.

  • Use LINQPad for extracting attachment

https://dreamingincrm.com/2018/01/18/export-all-attachments-using-linqpad/

Hope it helps..

Advertisements

Duration to Copy an environment – Dynamics 365


Recently as a part of our deployment activity – we had to copy one of our sandbox environment to another.

https://docs.microsoft.com/en-us/power-platform/admin/copy-environment

And we opted for Customizations and schemas only option

We had performed the activity a few days back and that time we opted for Everything (the environment size was around 3-4 GB) , it took around 40 minutes. So we were expecting the customization and schemas only option would be much faster.

Surprisingly it was more than 4 hours since we initiated the copy and it was still in progress, so we raised the Microsoft Support Ticket with severity A.

https://azure.microsoft.com/en-us/support/plans/response/

However, no sooner we raised the support request, in parallel the copy operation got completed.

Total it took around 4 .5 hours.

The reason as per the support team was that the server could be down for windows maintenance activity being it a weekend – Saturday.

Later at night also, we performed the same copy operation that time it took around 2.5 hours.

And recently 2-3 days after that day, we again performed the copy operation and it took the same 30-40 minutes – this being weekday.

So in case if it is taking more time than usual, you could raise a support ticket or could wait (if that is an option).

Hope it helps..

Advertisements

How to – Send an email using AddressUsed attribute of ActivityParty entity in Dynamics 365


When it comes to sending an email in Dynamics 365 / CE / CRM, we specify the entity’s record (with email enabled) in to, cc and bcc field of the email activity entity, and then the email address attribute of that particular record is used.

We can enable email for a custom entity also.

What if we have multiple email address fields specified for a custom entity?

The field which was created first will be used.

Check the below blog post –

https://debajmecrm.com/making-an-entity-enabled-to-send-emails-in-dynamics-365-and-its-existing-email-fields-gotchas/

What about entity like contact and account which have email, email address 2 and email address 3 fields?

If we trying sending an email to the above contact record, which has email address fields as blank programmatically we will get the below error

“Could not find the email address for the recipient of type ‘Contact’ with ID…”

What if we only have the email address 3 field having email id specified and the other 2 email field are blank?

This time our code will run without error, and CRM will pick up the email id specified in the email address 3 field. It will first check for email, then email address 2, and then finally email address 3 field. This happens only in the case of out of the box entity like contact and account.

What if we want to send an email to an email id not specified in the record?

Well in that case AddressUsed attribute of Activity Party can be used as shown below –

On running the above code, we can see the email specified in the addressused field being used

Understand more about activity party entity

https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/developers-guide/gg309626(v=crm.8)?redirectedfrom=MSDN

The helpful post

http://mostlymscrm.blogspot.com/2012/11/sending-emails-to-specific-address.html

Hope it helps..

string ConnectionString = "AuthType = OAuth; " +
"Username = userid;" +
"Password = pwd; " +
"Url = https://mydev.crm.dynamics.com/;" +
"AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;" +
"RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;" +
"LoginPrompt=Auto";

            CrmServiceClient svc = new CrmServiceClient(ConnectionString);

            if (svc.IsReady)
            {
                
                // guid of the contact record 
                Guid contactID = new Guid("0bd90832-bb52-eb11-bb23-000d3a5696d2");

                // initializing activity party entity
                Entity fromAP = new Entity("activityparty");
                Entity toAP = new Entity("activityparty");
                fromAP["partyid"] = new EntityReference("systemuser", new Guid("7de293e1-8352-eb11-bb23-000d3a569919"));
                toAP["partyid"] = new EntityReference("contact", contactID);

                // using the addressused attribute
                toAP["addressused"] = "nishant.rana.bliss@gmail.com";

                // create email record
                Entity email = new Entity("email");
                email["from"] = new Entity[] { fromAP };
                email["to"] = new Entity[] { toAP };
                email["regardingobjectid"] = new EntityReference("contact", contactID);
                email["subject"] = "Sample Subject";
                email["description"] = "This is sample description.";             
                Guid emailId = svc.Create(email);

                // Send email
                SendEmailRequest sendEmailRequest = new SendEmailRequest
                {
                    EmailId = emailId,                   
                    IssueSend = true
                };

                SendEmailResponse sendEmailResponse = (SendEmailResponse)svc.Execute(sendEmailRequest);

            }
Advertisements

How to – Create a custom API of type function in Dynamics 365 / Microsoft Dataverse


Continuing our previous posts,

Create Custom API Message
https://nishantrana.me/2021/01/13/use-custom-api-to-create-custom-messages-in-dynamics-365/

Allowed Custom Processing Step Type Property –

https://nishantrana.me/2021/01/20/allowed-custom-processing-step-type-allowedcustomprocessingsteptype-property-of-custom-api-in-dynamics-365-microsoft-dataverse/

Here we will create a custom API of type function by setting Is Function property as true.

  • The function requires HTTP GET method.
  • The function must include at least one Custom API Response Property defined.
  • The function cannot use Entity or Entity Collection Request Parameter, i.e. Binding Type can only be Global in case of Function.

Let us define a Custom API Response Property and associate it with the custom function defined.

Here we have defined a custom API response property of type Boolean.

The other data type supported are

Below is the plug-in that we will associate with the Custom API message, here we are setting the value of the response parameter.

Associated the plugin to the custom API message

Let us trigger our function using the Postman.

Invoking Custom APIs

https://docs.microsoft.com/en-us/powerapps/developer/data-platform/custom-api#invoking-custom-apis

Plugin trace log –

More information on Custom API

Hope it helps..

Advertisements