mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
feat(Microsoft Dynamics CRM Node): Add support for other regions than North America (#3157)
* Typo
* Added all dynamics regions
* Change uri to match credentials region
* ⚡ Small improvement
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
parent
0a69a9eb9c
commit
4bdd607fdf
|
@ -11,7 +11,7 @@ export class MicrosoftDynamicsOAuth2Api implements ICredentialType {
|
||||||
displayName = 'Microsoft Dynamics OAuth2 API';
|
displayName = 'Microsoft Dynamics OAuth2 API';
|
||||||
documentationUrl = 'microsoft';
|
documentationUrl = 'microsoft';
|
||||||
properties: INodeProperties[] = [
|
properties: INodeProperties[] = [
|
||||||
//https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent
|
// https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent
|
||||||
{
|
{
|
||||||
displayName: 'Subdomain',
|
displayName: 'Subdomain',
|
||||||
name: 'subdomain',
|
name: 'subdomain',
|
||||||
|
@ -20,11 +20,93 @@ export class MicrosoftDynamicsOAuth2Api implements ICredentialType {
|
||||||
placeholder: 'organization',
|
placeholder: 'organization',
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
// https://docs.microsoft.com/en-us/power-platform/admin/new-datacenter-regions
|
||||||
|
// https://arunpotti.com/2021/03/15/dynamics-365-crm-online-regions-list/
|
||||||
|
{
|
||||||
|
displayName: 'Region',
|
||||||
|
name: 'region',
|
||||||
|
type: 'options',
|
||||||
|
default: 'crm.dynamics.com',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Asia Pacific (APAC/ APJ)',
|
||||||
|
value: 'crm5.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Australia (OCE)',
|
||||||
|
value: 'crm6.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Canada (CAN)',
|
||||||
|
value: 'crm3.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'China (CHN)',
|
||||||
|
value: 'crm.dynamics.cn',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Europe, Middle East, Africa (EMEA/ EUR)',
|
||||||
|
value: 'crm4.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'France (FRA)',
|
||||||
|
value: 'crm12.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Germany (GER)',
|
||||||
|
value: 'crm16.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'India (IND)',
|
||||||
|
value: 'crm8.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Japan (JPN)',
|
||||||
|
value: 'crm7.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Microsoft Cloud Germany (DEU)',
|
||||||
|
value: 'crm.microsoftdynamics.de',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'North America (NAM)',
|
||||||
|
value: 'crm.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'North America 2 (US Gov GCC)',
|
||||||
|
value: 'crm9.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'South Africa (ZAF)',
|
||||||
|
value: 'crm14.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'South America (LATAM/ SAM)',
|
||||||
|
value: 'crm2.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Switzerland (CHE)',
|
||||||
|
value: 'crm17.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'United Arab Emirates (UAE)',
|
||||||
|
value: 'crm15.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'United Kingdom (UK/ GBR)',
|
||||||
|
value: 'crm11.dynamics.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'United States Government Community Cloud (GCC High)',
|
||||||
|
value: 'crm.microsoftdynamics.us',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Scope',
|
displayName: 'Scope',
|
||||||
name: 'scope',
|
name: 'scope',
|
||||||
type: 'hidden',
|
type: 'hidden',
|
||||||
default: '=openid offline_access https://{{$self.subdomain}}.crm.dynamics.com/.default',
|
default: '=openid offline_access https://{{$self.subdomain}}.{{$self.region}}/.default',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
export async function microsoftApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function microsoftApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
const credenitals = await this.getCredentials('microsoftDynamicsOAuth2Api') as { subdomain: string };
|
const credentials = await this.getCredentials('microsoftDynamicsOAuth2Api') as { subdomain: string, region: string };
|
||||||
|
|
||||||
let options: OptionsWithUri = {
|
let options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -27,7 +27,7 @@ export async function microsoftApiRequest(this: IExecuteFunctions | IExecuteSing
|
||||||
method,
|
method,
|
||||||
body,
|
body,
|
||||||
qs,
|
qs,
|
||||||
uri: uri || `https://${credenitals.subdomain}.crm.dynamics.com/api/data/v9.2${resource}`,
|
uri: uri || `https://${credentials.subdomain}.${credentials.region}/api/data/v9.2${resource}`,
|
||||||
json: true,
|
json: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue