How to – change user’s business unit without removing the security roles in Dynamics 365 / PowerApps (EnableOwnershipAcrossBusinessUnits setting)


When we change the user’s business unit, all the current security roles of the users are removed and we need to assign the roles again to the user. This has always been the default behavior. 

Also check – Modernize Business Units –  https://nishantrana.me/2022/01/04/modernize-business-units-matrix-data-access-structure-record-ownership-across-business-units-preview-in-dynamics-365-dataverse/

For E.g. below user User 2 belongs to Business Unit – BU 1 and has the following security roles assigned.

Now changing the user’s business unit to BU 2

will remove all his security roles assigned.

We can now override this behavior by updating the new option /setting added

EnableOwnershipAcrossBusinessUnits (this property determines if roles are removed when the principal changes business units) through the
Organization Settings Editor tool

After we have installed the managed solution, we can update the setting and set it as true

Let us assign the security roles to User 2 in BU 2.

Let us now change the BU of user 2 back to BU 1.


As expected after updating that setting – DoNotRemoveRolesOnChangeBusinessUnit– as true – we can see the security roles still intact, even on the change of Business Unit for the user.

What happens if user 2 is assigned a security role – BU2 Security Role, which is created in BU 2 Business unit and is not available in BU 1.

Let us change the business unit to BU 1.

As expected BU2 security role is not available in BU 1, so that role is not assigned, only the common security role coming from parent BU remains intact.

Hope it helps..

Advertisements

Understanding Queues in Dynamics 365 Customer Service (refresher)


  • What are Queues?

Queues are containers to store, organize, prioritize and monitor the progress of work items or queue items.

  • Which entity/table can be enabled for the queues?

All customizable entities can be enabled for queues.

Below we are enabling it for the lead entity.

Enabling it for the lead now allows lead records to be added to the queue.

  • By default, which entities are enabled for Queue?      Appointment, Campaignactivity, CampaignResponse, Email, Fax, Incident. Letter, PhoneCall, RecurringAppointmentMaster, ServiceAppointment, SocialActivity, Task
  • How do we create a Queue?

A queue is automatically created for each user and team. They can also be referred to as system queues as they are created by the system.

Below is the Queue created for each of the users.

User Queue –

Team Queue

The Team queue will have the same members as in the team.

Adding and removing the members from the Team will add and remove the members from the Queue also.

However it is not vice versa, that is, adding or removing members from the queue will not remove it from the team.

Here we are removing User 5 from Team’s queue –

On removing the member from the queue, the member is still there in the Team.

Adding user 6 in the Team will add it to the queue’s member.

The above automatically created queue is of type Private.

The private queue for the user is only available to the user and the private team queues are visible to only the team owner and members of that team.

  • What are the different types of queues?

The queue can be either of type private or public.

Public queues are available across the application and are created when you need work to be acted upon across the different users, unlike Private queues whose queue items are only accessible to the members of that queue.

E.g. one public queue can be created for high-priority cases, others could be for lesser priority items or there could be different public queues based on geography or product.

  • How do we create queues?

To create Queues, navigate to Service Management >> Queues in Customer Service.

Select New.

Below we have created a Public Queue.

Notice that we do not have the option to add members to a public queue, unlike a private queue.

Also, incoming email value can be specified for the queue, and based on the email settings – queue items would be created for the mail received.

Check below article for more details on the same –

https://crmkeeper.com/2020/04/20/dynamics-365-queue-setup-with-shared-mailbox/

https://nishantrana.me/2017/07/26/using-shared-mailbox-and-queue-in-crm-for-implementing-generic-email-address-in-dynamics-365-and-exchange-online/

https://nishantrana.me/2021/09/28/tracking-email-and-automatic-record-creation-personal-options-in-dynamics-365/

  • Now with the queue created private and public both, how do we add records/items to it?

Say we want to add a particular lead record, here we can navigate to view for the lead or open an individual lead record and select the option Add to Queue

By default, it loads the Business Queues

Below are the other Lookup Views available –

Let us assign it to the My Sample Public Queue we created earlier.

Back in the Queues area, we will have Items I am working on System View and Queues I’m a member of filter set by default.

As those are lead records are not yet picked for working on them, they are not available in the above view.

Let us change it to either All Items or Items available to work on and filter to either My Sample Public Queue, All Queues, or All Public Queues for the lead records / queue item to show up.

We can see the queue items (lead records) available to work on.

  • How can we change the default view for the Queue Items?

By using the Set current view as my default option.

  • Can we create more system views or hide the existing ones?

Yes navigate to View (Queue Items) inside the customization area, from there we can create new views, edit, activate, deactivate existing views.

E.g. we can create a new public view, that has filter criteria to show only the records of type lead.

  • How do we pick the items from the queue to work on?

Using the Pick command.

  • What happens when we pick a record from the queue?

A dialog box appears which informs that the item will be assigned to you and also the option to remove the item(s) from the queue.
Here we have selected the lead record with Title – Kim Abercrombie.

Let us leave it at No and click on Pick.

We can see the owner getting updated.

And the below details in the queue item record.

Worked by, Entered Queue and Modified on details updated.

And also as we had opted No for Remove the item from the Queue.

The item will be available on All Items view, but won’t be available on Items available to work on.

  • What happens when we Release the Item?

A dialog box appears that informs that the item will be assigned back to the queue’s owner and other members can pick up.

As expected the Item is added back to the queue.

And the Worked By field is set as blank for the queue item.

Also, the owner of the record is set to the queue owner.

  • What happens when we Remove the record instead of the Release command?

Now let us pick the same lead record again, and this time we will Remove it instead of Release.

This Remove option removes the Queue Item (a lead record) from the Queue. (My Sample Public Queue) in this case.

On checking the Queue Item Details for the record, we will get the below message.

Get all the details here –

https://docs.microsoft.com/en-us/dynamics365/customer-service/work-with-queues

https://neilparkhurst.com/2021/06/02/mb-230-microsoft-dynamics-365-customer-service-queues/

Also check – 

https://nishantrana.me/2020/09/18/queue-item-details-change-in-dynamics-365-2020-release-wave-2/

Hope it helps..

Advertisements

Using Force Sync User to sync PowerApp / CRM users – Power Platform / Dynamics 365


Recently in one of our trial environments, some of the users were not showing up in the Enabled Users view in Dynamics 365, although the users were having appropriate licenses assigned to them. (was more than 24 hours)

In such a scenario we can use Force Sync user action of Power Platform Management Connector.

https://docs.microsoft.com/en-us/connectors/powerplatformforadmins/

For Force Sync users, we will be passing the object id of the user and selecting the appropriate environment.

Run the flow manually.

It asks for the Object Id of user.

Inside Azure Portal >> Azure Active Directory >> Users, get the Object Id of the user

Currently, we have below 3 users in CRM

Let us run the flow.

Wait for the flow to complete.

After successful execution of the flow, back in CRM, we can see user 5 added to the list of enabled users.

In case we are using a security group for the environment we can make use of the below Power Automate Template, it takes the security group’s object id as input and loops through each of the members and applies Force Sync user action.

We can also make use of PowerShell cmdlets to achieve the same

https://nishantrana.me/2021/01/20/force-sync-users-from-azure-ad-to-dynamics-crm/

Force Sync Azure Active Directory Group members to specified CDS instance

Hope it helps..

Advertisements

Using Custom Process Action with Code for integration – Dynamics 365 / Microsoft Dataverse


There are 2 ways to create a custom message in Dataverse, one is through action, and the other is through Custom API.

Check the post on Custom API

https://nishantrana.me/tag/custom-api/

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

Custom Process Action vs Custom API –

https://docs.microsoft.com/en-us/powerapps/developer/data-platform/custom-actions#compare-custom-process-action-and-custom-api

With custom process action we can define business logic using a workflow, and we can extend it using either custom workflow activities or registering the plugin.

If we are just defining action just for the custom message and then using plugin/custom workflow activity for defining all the logic (and not using workflow), it is recommended to use the Custom API feature instead.

Here however we will have a look at the way we had implemented global custom action for integration with the external system for any inbound call to CRM.

Below is our sample custom global action with one input and output parameter.

For the output parameter, we are setting the value in the step.

Next, we have 2 plugin steps registered one on the pre-validation stage and the other on post-operation.

Pre-validation because we want to run the logic outside the transaction, perform validation, log exceptions, etc.

Pre-validation example –

https://nishantrana.me/2018/11/05/plugin-on-pre-validation-stage-in-dynamics-365-ce/

https://community.dynamics.com/365/sales/b/crminogic/posts/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error

Post-operation because action’s output parameter would only be available in the post-operation and used Shared Variable to pass the custom response from pre-validation plugin to post-operation.

On executing the action

We get the following plugin trace logs as expected.

One for pre-validation

Post-operation

Hope it helps..

Advertisements

Fixed: Action not appearing in Plugin Registration tool (Dynamics 365 / CE)


We had couple of actions created, but they were not appearing in the Plugin Registration Tool Plugin of XrmToolBox as shown below.

Refreshing the plugin, re-connecting to the organization, republishing the action, etc. didn’t work.

Eventually, we restarted the XrmToolBox and our messages started appearing.

Could be something related to Metadata cache.

Hope it helps..

Advertisements

Set Auto Number field value conditionally in Dynamics 365 / Dataverse


Recently we had a requirement to use auto numbers for lead records.

However, based on where the lead records are being created from, we wanted to specify a different prefix to it.

For leads created manually, the format should be prefixed “L” followed by “– “and then 10 digit sequence number.

L-{SEQNUM:10}

And if created through API the prefix should be B.

B-{SEQNUM:10}

To achieve this, we can define an auto-number field with the following format.


Next, we can have a bool field (default – false) in the lead table, to identify if it is being created from the API, which we can set while creating the lead record through API.

And a Pre Create Plugin on Lead to check the value of that field.

If it is set (true), that we can replace the Prefix from L to B in the auto-number field within the context.

In the Pre Create plugin, we get the next sequence in the auto-number field, so simply replacing/setting the value of the auto numbering field did the trick.

Lead created through Web Application –

Lead created through API –

Here uniqueness was more important than the next sequence of the lead record so this solution worked.

Also check –

https://jonasr.app/2020/03/anm-unique-seq/

https://nishantrana.me/2021/11/09/few-key-points-auto-number-field-in-dataverse-dynamics-365-ce-crm/

Hope it helps..

Advertisements
%d bloggers like this: