Delete the current (active) partition in Audit – Dynamics 365


We recently exceeded log storage capacity for our Power Platform environment

We can check the same at Resources >> Capacity inside the Power Platform admin center.

One of the sandbox environments had the most Log Usage

https://docs.microsoft.com/en-gb/power-platform/admin/legacy-capacity-storage#capacity-page-details

We deleted the plugin trace logs and all the audit partitions (except the active/current one, which the system doesn’t allow)

If we try deleting the current active partition, we will get the below error –

Microsoft.Crm.CrmException: You cannot delete audit data in the partitions that are currently in use, or delete the partitions that are created for storing future audit data.

The partitions are created on quarterly basis each year –

1 Jan – April, 1 April – July, 1 July – October, 1 Oct – January

Even after deleting the plugin trace logs and the partitions, we didn’t see any change in the storage capacity usage. So we raised a Microsoft Support Ticket and were informed by the team that they can delete the active partition for us, and it could take around 3 days. As that was a sandbox environment and we had no use of Audit data we went ahead and the Support Team deleted the active partition for us. (Also there was some issue in our data center with regards to the recalculation of the storage and it took few more days for that change to reflect inside the Capacity page of Power Platform Admin Center).

This way we were able to reclaim some of the log storage.

So basically we just need to raise Microsoft Support Ticket and request the same.

More on Audit

Also check the new process for deleting audit logs –

https://docs.microsoft.com/en-gb/power-platform/admin/free-storage-space#method-10-delete-audit-logs—new-process

Select audit logs to delete.

Hope it helps..

Tracking email and automatic record creation – Personal Options in Dynamics 365


Let us have a look at the different options provided in the Email Tab for Tracking and Automatic creation of records.

Select Personalization Settings in the Settings icon within the app.

Select Email tab within Set Personal Options Dialog box.

Select the email messages to track in Microsoft Dynamics 365 option has the following values

Email messages in response to Dynamics 365
email is the default option.

Let us start with the All email messages option.

  • All email messages – In the case of all email messages, all email messages will be tracked in Dynamics 365, including the junk mail.

Here we have sent a test email to the CRM User with Track All email messages selected

The CRM user has his mailbox already configured.

Sample mail sent to the CRM user from the personal Hotmail account.

Inside Outlook Office, we can see the same mail received and marked as Tracked to Dynamics 365.

And an email activity created inside CRM.

We can see the existing contact record having the matching email id being set as from for the email.

If no contact record is found with the same email id, then a new contact record will be created for the tracked email, if the below setting “automatically create record” is enabled.

Here I am now sending an email to the CRM user through my Gmail id. (This email id doesn’t exist in CRM for any records)

We can see the mail tracked, and the email activity created along with the new contact record.

Let us just disable create record option and also delete the existing contact records (both Hotmail and Gmail) with matching email id, so that no match is found.

Let us again send an email from the Hotmail account to the CRM user

This time in the email activity created, we see the email id marked as red as there were no matching records in CRM.

Also as we had disabled contact creation so no contact record was created.

  • What if we enable Lead Creation instead?

Remember we still do not have any existing matching contacts in CRM as we have deleted them.

Let us sent a test mail and check.

The email activity inside CRM will have the From part set as the lead record created as part of tracking.

Below is the lead record created with associated email

  • What if we have both lead and contact records with the matching email id, to which record will the tracked email be associated?

The answer is the contact record.

  • Now let us look at the other tracking option – Email messages from Dynamics 365 Leads, Contacts, and Accounts – In this case only if the email is originated from the user having an existing lead, contact, or account record will be tracked.

  • Let us send an email from an account that doesn’t have any lead, contact, or account record created inside CRM.

And also email from an account that has both lead and contact records.

After a couple of minutes, we can see the mail from the account having lead and contact records being tracked and the other email from an account that doesn’t have any matching records not being tracked.

The email activity is associated with the contact record as expected.

  • Now let us send the mail from an account with matching lead and contact, this time we have disabled the matching contact record.

So now the system has only a matching lead record.

We have disabled the matching contact record.

Result – We can see the email activity associated with the lead in this case as the contact was disabled.

  • Now let us disable and both matching lead and contact see the result.

And create one more custom entity record with email enabled having matching email id.

In this case, the email activity is associated with an active custom entity record having the matching email id


Now let us try the same by disabling this custom record as well i.e. now we have all the matching records lead, contact, and the custom entity one disabled.

Result – As no matching record was found it creates it against an email and highlights it in red.

It is tracked the email even though the record were inactive.

Now let us delete that inactive contact record and send the same mail from the same account. We have the create contact option enabled right now.

Result – The mail was tracked but no contact record was created.

  • Now let us delete the matching inactive lead record from CRM, and keep the matching inactive custom entity record as it is.

Result – Now as we do not have any lead or contact record, the email as expected is not tracked as we have opted for tracking – Email messages from leads, contact, and accounts.


  • Let us change the tracking option to Email messages from Dynamics 365 records that are email enabled – In this case, all email messages will be tracked for those entities having email-enabled (including custom entities)


We can see the email tracked even though the custom matching record is inactive.

  • Now let us set the tracking option as Email messages in response to Dynamics 365 email


This will track replies or forwards of email messages that have already been tracked.

Let us send a new mail, we only have an inactive matching custom entity record in CRM right now.

As expected the email is not traced as it is a new email, not a response.

  • Let us send another email, this time we have created a matching contact record in CRM.

As expected the emails are not tracked as they are not the responses.

  • Now let us respond to an existing tracked email.

Reply Sent From Outlook :

Reply From within CRM :

We can see it tracked in CRM.

  • And finally the last option No email messages is self-explanatory

In a nutshell

Tracking  
All Email Messages Email tracked, email activity created.

 

If an existing contact record is found, it is associated.

If no contact record is found, it will be created if Create contact record option is enabled. Here if for Create Option we have selected Lead then lead will be created instead.

If no existing record is found and create contact is disabled, then it is associated with an unknown email address (marked as red)

If both matching lead and contact records are found, then the contact record is associated with the email activity.

 
Email messages from Dynamics 365 Lead, Contact, and Account The email from only matching lead, contact, or account will be tracked.

 

Even if the matching record is disabled, the email is tracked.

Here even if the create option is enabled, no lead or contact records are created.

Email messages from Dynamics 365 records that are email enabled. It considers all the entities with email enabled not just lead, contact and account.
Email messages in response to Dynamics 365 email Only replies or forwards of email messages that have been already tracked will be considered for tracking.
No email messages No email messages are tracked.

Check the details here –

https://docs.microsoft.com/en-us/dynamics365/outlook-addin/user-guide/set-option-automatically-track-incoming-outlook-email#automatically-track-email-messages

Hope it helps..

Advertisements

How to – Export Dataverse (Dynamics 365) data to Azure SQL using Azure Data Factory pipeline template


[Visual Guide to Azure Data Factory - https://acloudguru.com/blog/engineering/a-visual-guide-to-azure-data-factory]

Using the new Azure Data Factory pipeline template – Copy Dataverse data from Azure Data Lake to Azure SQL – we can now easily export the Dataverse data to Azure SQL Database.

https://docs.microsoft.com/en-us/power-platform-release-plan/2021wave1/data-platform/export-dataverse-data-azure-sql-database

Check other posts on Azure Data Factory

Select Pipeline from template option inside the Data Factory

Search for Dataverse and select the Copy Dataverse data from Azure Data Lake to Azure SQL template

Let us specify the User Inputs required by the template – i.e. Azure SQL Database and the Data Lake Storage.

First we have created the linked service for the Azure SQL Database.

We’d use it to connect to the below table MyContacts.

Similarly create a linked service to Azure Data Lake Gen 2, which holds our Dataverse data.

Get the URL from the Container’s property. (replace blob with dfs in the URL)

To get the storage account key, select Access Keys >> Show Keys >> Copy the Key for the Storage Account.

Here we have already configured Azure Synapse Link for Dataverse

https://nishantrana.me/2020/09/07/export-data-from-common-data-service-to-azure-data-lake-storage-gen2/

Now as we have defined the User Inputs, select Use this template.

Navigate to the data flow created – DataverseToAzureSQL

Select our source ADLS and check and configure its properties.

Source Settings

Here we have the Inline dataset type set to Common Data Model and the Linked service is the AzureDataLakeStorage1 we created earlier.

Source Option

Specify the Dataverse folder for the Root Location.

Here we have specified the contact entity from our Data Lake Storage.

Projection

In the projection we have cleared the generated schema using Clear Schema, also selected Schema options >> Allow schema drift


We have enabled Allow schema drift option which will create the required columns in the destination Azure SQL Table.

Optimize

Inspect

Data preview

As we have not turned on Debug mode, there is nothing to preview

Now let us move to our Destination – SQL.

Sink

Here we have AzureSQLTable dataset connected to contact table in Azure SQL and have checked Allow schema drift option.


Below is our AzureSQLTable Dataset connected to the MyContacts table.

Settings

Here we have selected Allow Insert as the Update Method and Table
action as Recreate table – as we want the destination table to be re-created dynamically based on the source.

Mapping

We have left it to Auto mapping.

Optimize

Inspect

Data preview

Let us Publish All our changes and Debug our pipeline.

Let us monitor our pipeline run.

We can see that pipeline has run successfully and took around 4 minutes.

We can see the contact’s data copied to our Azure SQL successfully.

So here we covered the insert operation, in the next posts we’d see how we can configure update, upsert and delete operation.

Also, check

Posts on Azure Data Factory

Posts on Azure Data Lake

Hope it helps..

Update Personal Options / Personalization Settings using UpdateUserSettingsSystemUser Request – Dynamics 365


Recently we had a requirement to update the “Negative Currency Format” – Regional Options for all the users.

We could not find this option in our favorite plugin – User Settings Utility.

So to programmatically update it we use the below code.

Or using our most favorite plugin – SQL 4 CDS

Updating it to the required format – 5

The Result –

Get more details here-

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/usersettings?view=dynamics-ce-odata-9

Hope it helps..

C# Code –

  CrmServiceClient svc = new CrmServiceClient(ConnectionString);
            
            if (svc.IsReady)
            {
                var reqUpdateUserSettings = new UpdateUserSettingsSystemUserRequest();

                // GUID of the System User
                reqUpdateUserSettings.UserId = new Guid("18392d47-9dc0-eb11-8235-00224808ff23");

                // reference the usersettings Entity
                reqUpdateUserSettings.Settings = new Entity("usersettings");

                // update the negativecurrencyformatcode to appropriate integer value
                reqUpdateUserSettings.Settings.Attributes["negativecurrencyformatcode"] = 5;

                var response = (UpdateUserSettingsSystemUserResponse)
                    svc.Execute(reqUpdateUserSettings);
            }

SQL –

update usersettings 
set negativecurrencyformatcode = 5
where systemuserid = '18392d47-9dc0-eb11-8235-00224808ff23'
Advertisements

Fixed – We are having trouble loading your form preview. Check to make sure you have access error in Power Apps


While trying to open a form for customization for a custom entity we were getting below error within the maker portal.

The user was an admin user.

The same was the case in both Chrome and Edge browsers.

The only way we could proceed was by switching to classic experience.

Switching to Classic worked

After updating the form in classic and publishing the changes, the form started working properly in the maker portal also.

We were able to customize the form in both Chrome and Edge.

Hope it helps..

Advanced lookup in Model-driven Power Apps / Dynamics 365


To enabled Advanced Lookup, log into to Power Platform Admin Center, navigate to

Environment >> [Select Environment] >> Settings >> Behavior

Enable the Lookup behavior and Save.

This adds the Advanced Lookup option in the Lookup dialog.


Clicking on it opens the Advanced Lookup Grid 


We can perform SEARCH within a selected View, CHANGE a view, can FILTER it the results further to show only records owned, ADD a new record, SORT the grid.


The best part is we can open/edit an existing record as well as add new ones without losing the existing context.

Opening an existing record from the result opens the record in the new pop-up window as shown below.

Similarly, the Add new option opens the Quick Create form.

In case of special data type like Party List or Regarding, we can select multiple records of different entities we are presented with.

Similar the option to Add new records list all the tables/entities applicable to that lookup.

Thus the new advanced lookup makes working with Lookup much simpler and effective and we should start adapting / using it.

 

Blog posts on 2021 Release Wave 1 – Dynamics 365

Hope it helps..

 

Advertisements