Skip to content

Commit 80ab135

Browse files
authored
Merge pull request #32 from seanmcne/seanmcne-patch-1
webapi version change and new setting
2 parents 8df5207 + 3c7eea1 commit 80ab135

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

mspfedyn_/OrgDbOrgSettings/Settings.xml

+12-1
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,17 @@
12631263
description="Default value is false, if it's set to True: do not show the following track options in Personal Options (Email): 'All email messages', 'Email messages from D365 Leads, Contacts and Accounts', 'Email messages from D365 records that are email enabled'"/>
12641264

12651265
<!--ORGANIZTION ATTRIBUTE Settings - these are NOT OrgDbOrgSettings but Organization.Attribute(s) -->
1266+
<orgSetting minSupportedVersion="9.1.0.1100"
1267+
maxSupportedVersion="9.9.9999.9999"
1268+
name="EnableUnifiedInterfaceShellRefresh"
1269+
isOrganizationAttribute="true"
1270+
min=""
1271+
max=""
1272+
defaultValue="false"
1273+
settingType="Boolean"
1274+
supportUrl="http://msdn.microsoft.com/en-us/library/gg328408.aspx"
1275+
urlTitle="Organization entity attributes"
1276+
description="As of 1/15/2019 the default is Disabled but the default may be True for newly provisioned instances. Enabled/True or enables the new UCI Sitemap, if this is set to disabled the new UCI sitemap changes will be disabled." />
12661277
<orgSetting minSupportedVersion="8.0.0.0"
12671278
maxSupportedVersion="9.9.9999.9999"
12681279
name="IsSOPIntegrationEnabled"
@@ -1273,7 +1284,7 @@
12731284
settingType="Boolean"
12741285
supportUrl="http://msdn.microsoft.com/en-us/library/gg328408.aspx"
12751286
urlTitle="Organization entity attributes"
1276-
description="Enables or disables the SOPIntegration, if this is set to disabled it disables sales order processing assuming an integration will handle it. *DO NOT DISABLE THIS UNLESS YOU HAVE A SPECIFIC REASON TO DO SO*" />
1287+
description="Enables or disables the SOPIntegration, if this is ENABLED it *disables* sales order processing assuming an integration will handle it. *DO NOT SET TO TRUE UNLESS YOU HAVE A SPECIFIC REASON TO DO SO*" />
12771288
<orgSetting minSupportedVersion="5.0.9690.583"
12781289
maxSupportedVersion="9.9.9999.9999"
12791290
name="MaxRecordsForExportToExcel"

mspfedyn_/OrgDbOrgSettings/orgDBOrgSettings.html

+25-5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,26 @@
2323
SDK = { __namespace: true };
2424
};
2525
SDK.SOAP = {
26+
getVersionSpecificWebApiUrl: function () {
27+
var serverBuildVersion = new BuildVersion(8, 0, 0, 0);
28+
29+
//get the org version
30+
this.getCrmOrgDBVersion(
31+
onSuccess = function (serverVersion) {
32+
serverBuildVersion = serverVersion;
33+
},
34+
onError = function (error) {});
35+
36+
if (serverBuildVersion.major >= 9 && serverBuildVersion.minor >= 1) {
37+
return "/api/data/v9.1";
38+
}
39+
if (serverBuildVersion.major == 9 && serverBuildVersion.minor == 0) {
40+
return "/api/data/v9.0";
41+
}
42+
else {
43+
return "/api/data/v8.0";
44+
}
45+
},
2646
getCrmOrgDBVersion: function (successCallback, errorCallback) {
2747
///<summary>Async retrieves the newest version from CRM's about.aspx page</summary>
2848
///<param name="successCallback" Type="Function(BuildVersion)">The function to perform when an successfult response is returned.
@@ -105,7 +125,7 @@
105125
type: "GET",
106126
contentType: "application/json; charset=utf-8",
107127
datatype: "json",
108-
url: rootUrl + "/api/data/v8.0/organizations",
128+
url: rootUrl + this.getVersionSpecificWebApiUrl() + "/organizations",
109129
data: null,
110130
beforeSend: function (XMLHttpRequest) {
111131
//Specifying this header ensures that the results will be returned as JSON.
@@ -131,7 +151,7 @@
131151
contentType: "application/json; charset=utf-8",
132152
datatype: "json",
133153
//method: "MERGE", //not working on some IE/JQUERY versions
134-
url: rootUrl + "/api/data/v8.0/organizations" + "(" + organizationId + ")",
154+
url: rootUrl + this.getVersionSpecificWebApiUrl() + "/organizations" + "(" + organizationId + ")",
135155
data: oJSON.stringify({ orgdborgsettings: orgDbOrgSettingXml }),
136156
beforeSend: function (XMLHttpRequest) {
137157
XMLHttpRequest.setRequestHeader("Accept", "application/json");
@@ -173,7 +193,7 @@
173193
type: "PATCH",
174194
contentType: "application/json; charset=utf-8",
175195
datatype: "json",
176-
url: rootUrl + "/api/data/v8.0/organizations" + "(" + organizationId + ")",
196+
url: rootUrl + this.getVersionSpecificWebApiUrl() + "/organizations" + "(" + organizationId + ")",
177197
data: oJSON.stringify(update),
178198
beforeSend: function (XMLHttpRequest) {
179199
XMLHttpRequest.setRequestHeader("Accept", "application/json");
@@ -203,7 +223,7 @@
203223
type: "PATCH",
204224
contentType: "application/json; charset=utf-8",
205225
datatype: "json",
206-
url: rootUrl + "/api/data/v8.0/organizations" + "(" + organizationId + ")",
226+
url: rootUrl + this.getVersionSpecificWebApiUrl() + "/organizations" + "(" + organizationId + ")",
207227
data: oJSON.stringify(update),
208228
beforeSend: function (XMLHttpRequest) {
209229
XMLHttpRequest.setRequestHeader("Accept", "application/json");
@@ -223,7 +243,7 @@
223243
type: "GET",
224244
contentType: "application/json; charset=utf-8",
225245
datatype: "json",
226-
url: rootUrl + "/api/data/v8.0/solutions?$select=modifiedon,uniquename,organizationid,ismanaged,publisherid,version,versionnumber&$filter=uniquename eq 'OrganizationSettingsEditor'",
246+
url: rootUrl + this.getVersionSpecificWebApiUrl() +"/solutions?$select=modifiedon,uniquename,organizationid,ismanaged,publisherid,version,versionnumber&$filter=uniquename eq 'OrganizationSettingsEditor'",
227247
data: null,
228248
beforeSend: function (XMLHttpRequest) {
229249
//Specifying this header ensures that the results will be returned as JSON.

0 commit comments

Comments
 (0)