seanmcne / Microsoft.Xrm.Data.PowerShell

This module uses the CRM connection from Microsoft.Xrm.Tooling.CrmConnector.Powershell and provides common functions to create, delete, query, and update data as well as functions for common tasks such as publishing, and manipulating System & CRM User Settings, etc. The module should function for both Dynamics CRM Online and On-Premise environment.
201 stars 64 forks source link

Don't see all System Settings with Set-CrmSystemSettings #495

Closed danielsevinc closed 1 year ago

danielsevinc commented 2 years ago

Hi,

i would like to create a script for setting System Settings for all new Environments. As an example I'm not able to set the System Setting "Qualify lead experience". I see the property, when i run the cmds: $systemSettings = Get-CrmSystemSettings $systemsettings.QualifyLeadAdditionalOptions

but I'm not able to set this setting over the cmd Set-CrmSystemSettings.

seanmcne commented 2 years ago

Hi @danielsevinc this cmdlet hasn't, unfortunately, been able to keep up with the vast number of settings which are in the platform now. Essentially, each property has to be added as a property in this approach. What might be more helpful to you is to gather the settings (which for this come from the organization entity) in an object to compare such as:

$organization=Get-CrmRecords -EntityLogicalName organization -Fields *
#at this point you have the entire organization record with the organizationid 
#the following will dump out all the properties and their values - this is where many settings exist 
$organization.CrmRecords 

#here is the specific setting you reference above
$organization.CrmRecords.qualifyLeadAdditionalOptions

image

danielsevinc commented 2 years ago

Hi @seanmcne Thanks for your reply. I've tested your posted commands, and I receive the setting as described. But how can I set now a setting via PowerShell cmdlet? As example the "$organization.CrmRecords.qualifyLeadAdditionalOptions". If I want to set it to No instead of Yes.

craig-lund commented 2 years ago

@danielsevinc that is an interesting setting. Seems to be a bool but is not...

qualifyleadadditionaloptions Edm.String
Indicates whether prompt should be shown for new Qualify Lead Experience Display Name: Enable New Qualify Lead Experience with configuration MDD

These details can be found here: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/organization?view=dynamics-ce-odata-9

If you are able to define what the "string" value is I would suggest trying to use Set-CrmRecord to set the value.

cT-m00cat commented 1 year ago

@danielsevinc Interestingly I also found this.. I eventually decided to NOT use this cmdlet and wrote a script that allows me to define settings in a JSON file - get it all in hashtable with right data types... and then using Set-CrmRecord to update the entity

drop me a message if you want some assistance with it