Can we update ‘SYSTEM’ user in Dynamics 365 / Dataverse?


We recently were asked to check the possibility of updating the SYSTEM user specifically the primary email field of it.

https://docs.microsoft.com/en-us/power-platform/admin/system-application-users

Usually, we use SYSTEM user to specify the plugin’s execution context for business requirements that needs elevation of privileges.

And also we can neither update it from the user interface nor it is recommended to update the SYSTEM user.

If we try to update the user through code, we’d get the below error message

Error updating Users – No modifications to the ‘SYSTEM’ or ‘INTEGRATION’ user are permitted. [See the Execution Plan tab for details of where this error occurred]


Hope it helps..

 

Advertisements

Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate


Triggers triggeroutputs()?[‘body/_optionsetname_label’]

Get a row by id outputs(‘action_name’)?[‘body/optionsetname@OData.Community.Display.V1.FormattedValue’]

List Rows – items(‘action_name’)? [‘body/optionsetname@OData.Community.Display.V1.FormattedValue’]

D365 Demystified

Retrieving OptionSet Labels from CDS data in a Cloud Flow / Power Automate / Flow is an extra step than just picking from the Dynamic Values. Check this post!!

Scenario

While working with data that is either a result of a Dataverse Trigger (on Create/Update) or Action like (Get record, list record), the OptionSet fields from CDS/Dataverse return the Values of the OptionSet instead of the Text Labels –

  1. Let’s say this is the OptionSet in Dynamics
  2. And when you pick the OptionSet field from CDS either from an Action or a Trigger like this
    Let’s say I’m capturing this in a variable to show you

    I’m storing this in a variable for this example to show you

  3. I’ll capture the Value of the OptionSet i.e. the Value part

    Result –

  4. What needs to be displayed is the Label of the OptionSet! Let’s see how we can do this –

View original post 660 more words

[Step by Step] Canvas App using on-premise SQL server as Data Source


Easy to understand and follow article – thanks Rajeev.

Rajeev Pentyala - Microsoft Power Platform

In this post, lets see how to build a Canvas App with data from on-premise SQL Server.

Using Gateways ,data can be transferred quickly and securely between a canvas app and an on-premises data source, such as an on-premises SQL Server database or an on-premises SharePoint site.

Lets get started to configure a Gateway and read the on-premises SQL Data which acts as a Canvas App’s ‘Data Source’.

Prerequisites:

  • SQL Server with a Database and a simple table.

Gateway_13

  • Dynamics 365 subscription. Subscribe to 30 days trail here.

Configure a ‘Gateway’ to on-premise SQL Server:

We need to install ‘On-Premises Data Gateway’ service on the machine with ‘SQL Server’.

  • Connect to PowerApps maker portal using your Dynamics 365 credentials.
  • Go to Data -> Gateways and click on ‘+New gateway’ button.

Gateway_15.PNG

  • You will be redirected to downloads page and click on ‘Download’ under ‘On-Premises Data Gateway’ section.

Gateway_1

  • Download and click on the…

View original post 239 more words

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

How to – Hide and show controls in Canvas App based on security role of the user (Dataverse / Dynamics 365)


Suppose we have the below Maker and Checker Canvas App, with two button one for raising the request and the other for approving and rejecting the request.

We have below custom security roles created in our Dynamics 365

  • Maker
  • Checker

Here we want Submit a Request button to be visible only to users with Maker security role and the Approve and Reject Request button to users with Checker role.

For this we can write the below formula on Visible property of the button.

Add the Users and Security Roles data sources first.

If(

LookUp([@’Security Roles’], Name = “Maker”, Role) in Concat(LookUp([@Users], ‘Primary Email’ = User().Email).’Security Roles (systemuserroles_association)’, Role & “;”),

true,

false

)

 

Based on email address of the user, we are comparing the Maker security role with all the different roles assigned to the user, which we are fetching from systemuserroles_association.

  • User function in Power Apps

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-user

  • Lookup function in Power Apps

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

Hope it helps..

If(LookUp([@'Security Roles'], Name = "Maker", Role) in Concat(LookUp([@Users], 'Primary Email' = User().Email).'Security Roles (systemuserroles_association)', Role & ";"),
true,
false)
Advertisements

Fixed – Monitor taking too long to show display


Was using a BenQ GW280T monitor, which I had bought 10 years back around December of 2011. AT the time of writing it is almost 10 years for it. The monitor had been working flawlessly till last month., when it suddenly started taking around 2-3 minutes to show the display. The main power button’s light will flicker on and off till then. 2-3 minutes continued for the next 10 days or so and then then the duration increased to and then approximately around 10 minutes for some 15-20 days.

However, right now, it has started taking around 4-5 hours, directly from 10 minutes.
https://www.techspot.com/community/topics/monitor-taking-minutes-to-start-is-it-dying-fixable.205974/

Took it to the nearest repair shop, who mentioned that the issue was because of the failure of the capacitor. The repair took 1000 rupees (approx 14 USD) and the Monitor was up and running again. So if you are also facing the similar issue, better get it repaired instead of buying a new one.

Hope it helps..

 

Advertisements