Skip to content

Commit 7a39f84

Browse files
authored
Merge pull request #106 from shahzorkhan123/patch-4
Block Delete Settings if any OptinSettings are enabled.
2 parents e4a1316 + 07f7dcd commit 7a39f84

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

mspfedyn_/OrgDbOrgSettings/Settings.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
<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. " />
153153
<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.)" />
154154
<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." />
155-
<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)." />
155+
<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)." />
156156
<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" />
157157
<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" />
158158
<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." />
@@ -172,7 +172,7 @@
172172
<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." />
173173
<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." />
174174
<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." />
175-
<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." />
175+
<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." />
176176
<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." />
177177
<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." />
178178
<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;" />
@@ -192,4 +192,4 @@
192192
<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." />
193193
<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" />
194194
<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)." />
195-
</defaultOrgSettings>
195+
</defaultOrgSettings>

mspfedyn_/OrgDbOrgSettings/orgDBOrgSettings.html

+25-2
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@
750750
},
751751
_settings: new Array()
752752
};
753-
function orgSetting(name, value, type, min, max, defaultValue, supportUrl, description, minSupportedVersion, urlTitle, maxSupportedVersion, isOrganizationAttribute, isNullable, isReadonly) {
753+
function orgSetting(name, value, type, min, max, defaultValue, supportUrl, description, minSupportedVersion, urlTitle, maxSupportedVersion, isOrganizationAttribute, isNullable, isReadonly,isOptInSetting) {
754754
/// <summary>Object defention of orgSetting</summary>
755755
/// <param name='name' type='String'>Setting name</param>
756756
/// <param name='value' type='Object'>Setting value</param>
@@ -759,6 +759,8 @@
759759
/// <param name='max' type='Number'>Maximum Int value</param>
760760
/// <param name='isOrganizationAttribute' type='Boolean'>Does this setting exist in the OrganizationEntity? (Not orgDbOrgSettings)</param>
761761
/// <param name='isNullable' type='Boolean'>Does this setting allow for null?</param>
762+
/// <param name='isReadonly' type='Boolean'>Does this setting allow for updates</param>
763+
/// <param name='isOptInSetting' type='Boolean'>Does this setting allow for reset</param>
762764
/// <returns type="orgSetting">An instance of an orgSetting()</returns>
763765
this.name = name;
764766
this.value = value
@@ -774,6 +776,7 @@
774776
this.isOrganizationAttribute = isOrganizationAttribute || false; //default to false
775777
this.isNullable = isNullable || false; //default to false
776778
this.isReadonly = isReadonly || false; //default to false
779+
this.isOptInSetting = isOptInSetting || false; //default to false
777780
};
778781
orgSetting.prototype = {
779782
isNullValue: function () {
@@ -1051,6 +1054,21 @@
10511054
};
10521055
function deleteSetting(strSettingToDelete) {
10531056
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 +".")) {
1057+
// Validate there is no OptIn Settings.
1058+
var optedInSettings = "";
1059+
o$.each(SDK.Settings.OrganizationSettings.getAllSettings(), function (index, setting) {
1060+
///<param name="setting" type="orgSetting"/>
1061+
///<param name="index" type="int"/>
1062+
if (setting != null && setting.value != null && !setting.isOrganizationAttribute && setting.isOptInSetting && setting.value !== false) {
1063+
optedInSettings += setting.name + ',';
1064+
}
1065+
});
1066+
1067+
if (optedInSettings !== "")
1068+
{
1069+
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");
1070+
return;
1071+
}
10541072
enableProgressDiv(true);
10551073

10561074
var settingToDelete = SDK.Settings.OrganizationSettings.getSetting(strSettingToDelete);
@@ -1337,6 +1355,7 @@
13371355
if (serverBuildVersion.isGreaterThanOrEq(BuildVersion.parseBuildNumber(minVer)) && serverBuildVersion.isLessThanOrEq(BuildVersion.parseBuildNumber(maxVer))) {
13381356
var isNullable = false;
13391357
var isReadonly = false;
1358+
var isOptInSetting = false;
13401359
var isOrganizationAttribute = false;
13411360
var currentSettingValue = null;
13421361
var currentSettingName = curNode.attributes.getNamedItem("name").value;
@@ -1354,6 +1373,9 @@
13541373
if (null != curNode.attributes.getNamedItem("isReadonly")) {
13551374
isReadonly = parseValueFromTypeName("boolean", curNode.attributes.getNamedItem("isReadonly").value);
13561375
}
1376+
if (null != curNode.attributes.getNamedItem("isOptInSetting")) {
1377+
isOptInSetting = parseValueFromTypeName("boolean", curNode.attributes.getNamedItem("isOptInSetting").value);
1378+
}
13571379
//yammer check
13581380
if (!SDK.Settings.isYammerConfigured &&
13591381
currentSettingName.toLowerCase().indexOf("yammer") === 0 &&
@@ -1376,7 +1398,8 @@
13761398
maxVer,
13771399
isOrganizationAttribute,
13781400
isNullable,
1379-
isReadonly
1401+
isReadonly,
1402+
isOptInSetting
13801403
)
13811404
);
13821405
}

0 commit comments

Comments
 (0)