Skip to content

Commit

Permalink
Merge pull request #106 from shahzorkhan123/patch-4
Browse files Browse the repository at this point in the history
Block Delete Settings if any OptinSettings are enabled.
  • Loading branch information
seanmcne authored Sep 22, 2023
2 parents e4a1316 + 07f7dcd commit 7a39f84
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
6 changes: 3 additions & 3 deletions mspfedyn_/OrgDbOrgSettings/Settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
<orgSetting minSupportedVersion="9.1.0.14145" maxSupportedVersion="9.9.9999.9999" name="EmailTemplateRetrieveFallbackContact" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="http://support.microsoft.com/kb/2691237" urlTitle="KB 2691237" description="Scenario: Opportunity/case which refer to a customerId of type account and do that account does not have a primary contact specified. &lt;br&gt;False: (Default behavior) Use the primary account and retrieve the primary contact, if the account is null it will leave the contact field in the email template null. &lt;br&gt;True: Fall back to using the Opportunity or Case primaryContactId if the account reference is null. " />
<orgSetting minSupportedVersion="9.1.0.16819" maxSupportedVersion="9.2.21114.00135" name="CreateQueueItemForSynchronizingMailbox" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="http://support.microsoft.com/kb/2691237" urlTitle="KB 2691237" description="When tracking an email into Dynamics, create a queue item for the queue which is synchronizing the email message (this will affect queue item creation for mailboxes in the BCC line or contained in a distribution list.)" />
<orgSetting minSupportedVersion="9.1.0000.10537" maxSupportedVersion="9.9.9999.9999" name="DupeDetectionSkipIfNoMatchCodeFieldsChanged" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="http://support.microsoft.com/kb/2691237" urlTitle="KB 2691237" description="Skip duplicate detection record updates if none of the relevant/included match code fields change." />
<orgSetting minSupportedVersion="9.1.0.17162" maxSupportedVersion="9.9.9999.9999" name="EnableTDSEndpoint" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/cds-sql-query" urlTitle="KB 2691237" description="Enable a SQL TDS Endpoint for your CDS Environment - NOTE: your region will also have to support TDS endpoints, the regions with support for TDS may vary (as documented in the docs url provided here)." />
<orgSetting minSupportedVersion="9.1.0.17162" maxSupportedVersion="9.9.9999.9999" name="EnableTDSEndpoint" isOptInSetting="true" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/cds-sql-query" urlTitle="KB 2691237" description="Enable a SQL TDS Endpoint for your CDS Environment - NOTE: your region will also have to support TDS endpoints, the regions with support for TDS may vary (as documented in the docs url provided here)." />
<orgSetting minSupportedVersion="9.1.0.16843" maxSupportedVersion="9.9.9999.9999" name="EnableLicenseEnforcement" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="https://docs.microsoft.com/en-us/dynamics365/get-started/team-members-license" urlTitle="Licensing FAQ" description="Online only setting to enable license enforcing for organizations/environments created before 4/1/2020 for customer testing purposes" />
<orgSetting minSupportedVersion="9.1.0.16843" maxSupportedVersion="9.9.9999.9999" name="CleanInheritedAccessWhenReparentOrShareCascadingNone" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="http://support.microsoft.com/kb/2691237" urlTitle="KB 2691237" description="Clean out all inherited access when reparenting or after cascade sharing is set to none" />
<orgSetting minSupportedVersion="9.1.0.19239" maxSupportedVersion="9.9.9999.9999" name="SSSPropagateAppointmentCancellationsToExchange" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="https://community.dynamics.com/crm/b/crminthefield/posts/dynamics-365-app-for-outlook-part-5-working-with-appointments" urlTitle="KB 2691237" description="Enabling the feature allows appointment cancellations from Dynamics to propagate to Exchange via SSS." />
Expand All @@ -172,7 +172,7 @@
<orgSetting minSupportedVersion="9.1.0.25852" maxSupportedVersion="9.999.9999.9999" name="AllowDisabledUsersAddedToOwnerTeams" isOrganizationAttribute="false" min="" max="" defaultValue="False" settingType="Boolean" supportUrl="https://docs.microsoft.com/en-us/power-platform/admin/manage-teams" urlTitle=" Manage teams" description="Adding this property to allows adding of disabled users to owner teams." />
<orgSetting minSupportedVersion="9.2.0.21024" maxSupportedVersion="9.999.9999.9999" name="DoNotRemoveRolesOnChangeBusinessUnit" isOrganizationAttribute="false" min="" max="" defaultValue="False" settingType="Boolean" supportUrl="http://support.microsoft.com/kb/2691237" urlTitle="KB 2691237" description="Adding this property determines if roles are removed when principal changes business units. &lt;b&gt;WARNING&lt;/b&gt;: this setting may take a long time to save when changed." />
<orgSetting minSupportedVersion="9.2.0.21041" maxSupportedVersion="9.9.9999.9999" name="AlwaysMoveRecordToOwnerBusinessUnit" isOrganizationAttribute="false" min="" max="" defaultValue="true" settingType="Boolean" supportUrl="http://support.microsoft.com/kb/2691237" urlTitle="KB 2691237" description="Adding this property determines if a record's business unit updates to owner's BU when owner changes. &lt;b&gt;WARNING&lt;/b&gt;: this setting may take a long time to save when changed." />
<orgSetting minSupportedVersion="9.2.0.21053" maxSupportedVersion="9.9.9999.9999" name="EnableOwnershipAcrossBusinessUnits" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="http://support.microsoft.com/kb/2691237" urlTitle="KB 2691237" description="Online only setting to enable Record Ownership Across Business Units. &lt;b&gt;WARNING&lt;/b&gt;: this setting may take a long time to save when changed." />
<orgSetting minSupportedVersion="9.2.0.21053" maxSupportedVersion="9.9.9999.9999" name="EnableOwnershipAcrossBusinessUnits" isOptInSetting="true" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="http://support.microsoft.com/kb/2691237" urlTitle="KB 2691237" description="Online only setting to enable Record Ownership Across Business Units. &lt;b&gt;WARNING&lt;/b&gt;: this setting may take a long time to save when changed." />
<orgSetting minSupportedVersion="9.2.0.21053" maxSupportedVersion="9.9.9999.9999" name="RecomputeOwnershipAcrossBusinessUnits" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="http://support.microsoft.com/kb/2691237" urlTitle="KB 2691237" description="Online only setting to recompute Record Ownership Across Business Units. &lt;b&gt;WARNING&lt;/b&gt;: this setting may take a long time to save when changed." />
<orgSetting minSupportedVersion="9.2.0.21032" maxSupportedVersion="9.9.9999.9999" name="ManagersMustBeInSameOrParentBusinessUnitAsReports" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="http://support.microsoft.com/kb/2691237" urlTitle="KB 2691237" description="Adding this property determines if managers need to be in parent or same BU as direct reports. &lt;b&gt;WARNING&lt;/b&gt;: this setting may take a long time to save when changed." />
<orgSetting minSupportedVersion="9.2.21114.00136" maxSupportedVersion="9.9999.9999.9999" name="CreateQueueItemForSynchronizingMailbox" isOrganizationAttribute="false" min="" max="" defaultValue="true" settingType="Boolean" supportUrl="http://support.microsoft.com/kb/2691237" urlTitle="KB 2691237" description="&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;When tracking an email into Dynamics, create a queue item for the queue which is synchronizing the email message (this will affect queue item creation for mailboxes in the BCC line or contained in a distribution list.)&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;" />
Expand All @@ -192,4 +192,4 @@
<orgSetting minSupportedVersion="9.2.22082.00007" maxSupportedVersion="9.9.9999.9999" name="IsAccessCheckerNonAdminAllUsersEnabled" isOrganizationAttribute="false" min="" max="" defaultValue="false" settingType="Boolean" supportUrl="https://learn.microsoft.com/en-us/power-apps/user/access-checker#check-another-users-access-to-a-row" urlTitle="Learn: UserAccess" description="Allow Non-Admin users to see All User's access." />
<orgSetting minSupportedVersion="9.2.23040.0" maxSupportedVersion="9.999.9999.9999" name="AzureSynapseLinkIncrementalUpdateTimeInterval" isOrganizationAttribute="false" min="15" max="999999" defaultValue="1440" settingType="Number" supportUrl="http://support.microsoft.com/kb/2691237" urlTitle="KB 2691237" description="Time (minutes) Interval for AzureSynapseLink IncrementalUpdate" />
<orgSetting minSupportedVersion="9.2.23044.00224" maxSupportedVersion="9.9999.9999.9999" name="DaysBeforeEmailDescriptionIsMigrated" isOrganizationAttribute="true" min="1" max="365" defaultValue="365" settingType="Number" urlTitle="Email Storage" supportUrl="https://learn.microsoft.com/en-us/power-apps/developer/data-platform/email-activity-entities?branch=main" description="Number of days to wait to migrate Email Description to blob (max 365)." />
</defaultOrgSettings>
</defaultOrgSettings>
27 changes: 25 additions & 2 deletions mspfedyn_/OrgDbOrgSettings/orgDBOrgSettings.html
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@
},
_settings: new Array()
};
function orgSetting(name, value, type, min, max, defaultValue, supportUrl, description, minSupportedVersion, urlTitle, maxSupportedVersion, isOrganizationAttribute, isNullable, isReadonly) {
function orgSetting(name, value, type, min, max, defaultValue, supportUrl, description, minSupportedVersion, urlTitle, maxSupportedVersion, isOrganizationAttribute, isNullable, isReadonly,isOptInSetting) {
/// <summary>Object defention of orgSetting</summary>
/// <param name='name' type='String'>Setting name</param>
/// <param name='value' type='Object'>Setting value</param>
Expand All @@ -759,6 +759,8 @@
/// <param name='max' type='Number'>Maximum Int value</param>
/// <param name='isOrganizationAttribute' type='Boolean'>Does this setting exist in the OrganizationEntity? (Not orgDbOrgSettings)</param>
/// <param name='isNullable' type='Boolean'>Does this setting allow for null?</param>
/// <param name='isReadonly' type='Boolean'>Does this setting allow for updates</param>
/// <param name='isOptInSetting' type='Boolean'>Does this setting allow for reset</param>
/// <returns type="orgSetting">An instance of an orgSetting()</returns>
this.name = name;
this.value = value
Expand All @@ -774,6 +776,7 @@
this.isOrganizationAttribute = isOrganizationAttribute || false; //default to false
this.isNullable = isNullable || false; //default to false
this.isReadonly = isReadonly || false; //default to false
this.isOptInSetting = isOptInSetting || false; //default to false
};
orgSetting.prototype = {
isNullValue: function () {
Expand Down Expand Up @@ -1051,6 +1054,21 @@
};
function deleteSetting(strSettingToDelete) {
if (confirm("Are you absolutely sure you want to remove: " + strSettingToDelete + "?") && confirm("As a backup, take a screenshot of your settings before you do this.\r\nDo you still wish to proceed?\r\n\r\nTechnically this deletes all settings from CRM then adds all the settings back with the exception of " +strSettingToDelete +".")) {
// Validate there is no OptIn Settings.
var optedInSettings = "";
o$.each(SDK.Settings.OrganizationSettings.getAllSettings(), function (index, setting) {
///<param name="setting" type="orgSetting"/>
///<param name="index" type="int"/>
if (setting != null && setting.value != null && !setting.isOrganizationAttribute && setting.isOptInSetting && setting.value !== false) {
optedInSettings += setting.name + ',';
}
});

if (optedInSettings !== "")
{
updateBanner("The following opt-in settings are enabled: " + optedInSettings + ". Reseting these settings may lead to opting out of existing features. Set these opt-in settings to false *before* trying to delete remove any other settings.", false, "OptInSettingsAlert");
return;
}
enableProgressDiv(true);

var settingToDelete = SDK.Settings.OrganizationSettings.getSetting(strSettingToDelete);
Expand Down Expand Up @@ -1337,6 +1355,7 @@
if (serverBuildVersion.isGreaterThanOrEq(BuildVersion.parseBuildNumber(minVer)) && serverBuildVersion.isLessThanOrEq(BuildVersion.parseBuildNumber(maxVer))) {
var isNullable = false;
var isReadonly = false;
var isOptInSetting = false;
var isOrganizationAttribute = false;
var currentSettingValue = null;
var currentSettingName = curNode.attributes.getNamedItem("name").value;
Expand All @@ -1354,6 +1373,9 @@
if (null != curNode.attributes.getNamedItem("isReadonly")) {
isReadonly = parseValueFromTypeName("boolean", curNode.attributes.getNamedItem("isReadonly").value);
}
if (null != curNode.attributes.getNamedItem("isOptInSetting")) {
isOptInSetting = parseValueFromTypeName("boolean", curNode.attributes.getNamedItem("isOptInSetting").value);
}
//yammer check
if (!SDK.Settings.isYammerConfigured &&
currentSettingName.toLowerCase().indexOf("yammer") === 0 &&
Expand All @@ -1376,7 +1398,8 @@
maxVer,
isOrganizationAttribute,
isNullable,
isReadonly
isReadonly,
isOptInSetting
)
);
}
Expand Down

0 comments on commit 7a39f84

Please sign in to comment.