System User in D365
Introduction:
In this blog we will be discussing about System user in D365.
Description:
System Users are built in users in D365.
Some important points that need to be kept in mind are as follows:
- The Mailboxes of the System user cannot be setup hence emails can’t be sent and received.
- If a plugin is run with the System user context then it bypasses all the security rules.
- No one can log in to the system as the System User.
- The System user is in the base business unit.
- There might be situations when we not only want the plugin to update records that can be viewed by us but there is a need to update the other records to which we don’t have access to, in this situation we can run the plugin with the System User context.
- A plugin can call other plugin/workflows hence if a plugin is run in the context of System User then all the other plugins that are run because of the parent plugin will also be run in the same context.
Implementation:
Step 1: By default, in D365 the System User can’t be seen in the users’ section, as shown in the below two views.
On Searching in the Disabled Users also it doesn’t show the System User.
The owner of the record can’t be changed to System Owner from the lookup field as System User does not show up.
Step 2: There might be situations when we might need to perform checks on the record to know if the owner is System User or not to carry out some operations.
If there are no records in D365 with the owner as System User then it’s a problem.
One way of creating a record with System owner is by using plugins to create a record and run the Plugin in the System users context as shown below.
Step 3: After that is done as shown in the below image the owner is set as System. Now we can perform our business logic as we have a record with the SYSTEM as the owner.
Step 4: Now if we click on the Owner we go to the record which is read only and see the following details as shown below.
Step 5: We can’t modify any details of this user. If we try to add a security role to this user we get the following error message as shown below.