|
750 | 750 | },
|
751 | 751 | _settings: new Array()
|
752 | 752 | };
|
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) { |
754 | 754 | /// <summary>Object defention of orgSetting</summary>
|
755 | 755 | /// <param name='name' type='String'>Setting name</param>
|
756 | 756 | /// <param name='value' type='Object'>Setting value</param>
|
|
759 | 759 | /// <param name='max' type='Number'>Maximum Int value</param>
|
760 | 760 | /// <param name='isOrganizationAttribute' type='Boolean'>Does this setting exist in the OrganizationEntity? (Not orgDbOrgSettings)</param>
|
761 | 761 | /// <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> |
762 | 764 | /// <returns type="orgSetting">An instance of an orgSetting()</returns>
|
763 | 765 | this.name = name;
|
764 | 766 | this.value = value
|
|
774 | 776 | this.isOrganizationAttribute = isOrganizationAttribute || false; //default to false
|
775 | 777 | this.isNullable = isNullable || false; //default to false
|
776 | 778 | this.isReadonly = isReadonly || false; //default to false
|
| 779 | + this.isOptInSetting = isOptInSetting || false; //default to false |
777 | 780 | };
|
778 | 781 | orgSetting.prototype = {
|
779 | 782 | isNullValue: function () {
|
|
1051 | 1054 | };
|
1052 | 1055 | function deleteSetting(strSettingToDelete) {
|
1053 | 1056 | 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 | + } |
1054 | 1072 | enableProgressDiv(true);
|
1055 | 1073 |
|
1056 | 1074 | var settingToDelete = SDK.Settings.OrganizationSettings.getSetting(strSettingToDelete);
|
|
1337 | 1355 | if (serverBuildVersion.isGreaterThanOrEq(BuildVersion.parseBuildNumber(minVer)) && serverBuildVersion.isLessThanOrEq(BuildVersion.parseBuildNumber(maxVer))) {
|
1338 | 1356 | var isNullable = false;
|
1339 | 1357 | var isReadonly = false;
|
| 1358 | + var isOptInSetting = false; |
1340 | 1359 | var isOrganizationAttribute = false;
|
1341 | 1360 | var currentSettingValue = null;
|
1342 | 1361 | var currentSettingName = curNode.attributes.getNamedItem("name").value;
|
|
1354 | 1373 | if (null != curNode.attributes.getNamedItem("isReadonly")) {
|
1355 | 1374 | isReadonly = parseValueFromTypeName("boolean", curNode.attributes.getNamedItem("isReadonly").value);
|
1356 | 1375 | }
|
| 1376 | + if (null != curNode.attributes.getNamedItem("isOptInSetting")) { |
| 1377 | + isOptInSetting = parseValueFromTypeName("boolean", curNode.attributes.getNamedItem("isOptInSetting").value); |
| 1378 | + } |
1357 | 1379 | //yammer check
|
1358 | 1380 | if (!SDK.Settings.isYammerConfigured &&
|
1359 | 1381 | currentSettingName.toLowerCase().indexOf("yammer") === 0 &&
|
|
1376 | 1398 | maxVer,
|
1377 | 1399 | isOrganizationAttribute,
|
1378 | 1400 | isNullable,
|
1379 |
| - isReadonly |
| 1401 | + isReadonly, |
| 1402 | + isOptInSetting |
1380 | 1403 | )
|
1381 | 1404 | );
|
1382 | 1405 | }
|
|
0 commit comments