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

Sending
User Review
0 (0 votes)

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