Skip to content

Commit

Permalink
Merge branch 'release/1.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
nsteenbeek committed Apr 16, 2020
2 parents 87829ca + bcf2a1f commit ce97914
Show file tree
Hide file tree
Showing 19 changed files with 394 additions and 32 deletions.
2 changes: 1 addition & 1 deletion bin/main.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bin/root/src/Annotation/Annotation.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ export interface AnnotationModel extends Model {
logicalName: string;
};
subject?: string;
versionnumber?: string;
}
27 changes: 23 additions & 4 deletions bin/root/src/WebApi/Model.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
import {WebApi} from './WebApi';

export interface Model {
createdon?: string;
modifiedon?: string;
//Attributes for $select
statecode?: number;
owneridname?: string;
importsequencenumber?: number;
utcconversiontimezonecode?: number;
modifiedbyname?: string;
timezoneruleversionnumber?: number;
modifiedon?: string;
statuscode?: number;
versionnumber?: string;
ownerid?: string;
createdbyname?: string;
createdon?: string;
createdonbehalfbyname?: string;
modifiedonbehalfbyname?: string;
versionnumber?: number;
overriddencreatedon?: string;

// Attributes/NavigationProperties for $select and $expand
createdby?: string | Model; // SystemuserModel
createdonbehalfby?: string | Model; // SystemuserModel
modifiedby?: string | Model; // SystemuserModel
modifiedonbehalfby?: string | Model; // SystemuserModel
owninguser?: string | Model; // SystemuserModel
owningteam?: string | Model; // TeamModel
ownerid?: string | Model; // OwnerModel
owningbusinessunit?: string | Model; // BusinessunitModel
}

type ValidationCategory = 'Mandatory' | 'Invalid key';
Expand Down
2 changes: 1 addition & 1 deletion bin/root/src/WebApi/WebApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type QueryFunction = 'Above' | 'AboveOrEqual' | 'Between' | 'Contains' | 'Contai
'EqualUserOrHierarchyAndTeams' | 'EqualUserOrUserTeams' | 'EqualUserTeams' | 'In' | 'InFiscalPeriod' | 'InFiscalPeriodAndYear' | 'InFiscalYear' | 'InOrAfterFiscalPeriodAndYear' |
'InOrBeforeFiscalPeriodAndYear' | 'Last7Days' | 'LastFiscalPeriod' | 'LastFiscalYear' | 'LastMonth' | 'LastWeek' | 'LastXDays' | 'LastXFiscalPeriods' | 'LastXFiscalYears' | 'LastXHours' |
'LastXMonths' | 'LastXWeeks' | 'LastXYears' | 'LastYear' | 'Next7Days' | 'NextFiscalPeriod' | 'NextFiscalYear' | 'NextMonth' | 'NextWeek' | 'NextXDays' | 'NextXFiscalPeriods' |
'NextXFiscalYears' | 'NextXHourds' | 'NextXMonths' | 'NextXWeeks' | 'NextXYears' | 'NextYear' | 'NotBetween' | 'NotEqualBusinessId' | 'NotEqualUserId' | 'NotIn' | 'NotUnder' | 'OlderThanXDays' |
'NextXFiscalYears' | 'NextXHours' | 'NextXMonths' | 'NextXWeeks' | 'NextXYears' | 'NextYear' | 'NotBetween' | 'NotEqualBusinessId' | 'NotEqualUserId' | 'NotIn' | 'NotUnder' | 'OlderThanXDays' |
'OlderThanXHours' | 'OlderThanXMinutes' | 'OlderThanXMonths' | 'OlderThanXWeeks' | 'OlderThanXYears' | 'On' | 'OnOrAfter' | 'OnOrBefore' | 'ThisFiscalPerios' | 'ThisFiscalYear' | 'ThisMonth' |
'ThisWeek' | 'ThisYear' | 'Today' | 'Tomorrow' | 'Under' | 'UnderOrEqual' | 'Yesterday';
const filterConditions = ['eq' , 'ne', 'gt', 'ge', 'lt', 'le'] as const;
Expand Down
24 changes: 24 additions & 0 deletions bin/root/src/util/FormUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,28 @@ export class FormUtil {
}
});
}

static async getLookupValue(attributeName: string, id: string, executionContext: Xrm.Events.EventContext): Promise<Xrm.LookupValue> {
const formContext = executionContext.getFormContext(),
entityName = formContext.data.entity.getEntityName(),
entityMetadata = await Xrm.Utility.getEntityMetadata(entityName, [attributeName]),
attributeMetadata = entityMetadata.Attributes.get(attributeName);
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
for (const target of attributeMetadata.Targets) {
try {
const targetEntityMetadata = await Xrm.Utility.getEntityMetadata(target),
entity = await Xrm.WebApi.retrieveRecord(target, id, `?$select=${targetEntityMetadata.PrimaryNameAttribute}`);
if (entity) {
return {
entityType: target,
id: id,
name: entity[targetEntityMetadata.PrimaryNameAttribute]
};
}
} catch (e) {
// try next target
}
}
}
}
2 changes: 1 addition & 1 deletion bin/root/tools/deploy.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/root/tools/resx.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/root/tools/setFormCustomizable.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hso/d365-cli",
"version": "1.5.3",
"version": "1.6.0",
"author": "HSO Innovation <[email protected]> (http://www.hso.com)",
"description": "HSO D365 Command Line Interface",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion src/Entity.ts → src/generator/Entity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as colors from 'colors';
import * as shell from 'shelljs';
import * as inquirer from 'inquirer';
import {Variables} from './Variables';
import {Variables} from '../Variables';

export class Entity {
public static generateEntity(entityname: string): Promise<void> {
Expand Down
5 changes: 4 additions & 1 deletion src/Generator.ts → src/generator/Generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import * as shell from 'shelljs';
import {Entity} from './Entity';
import {Webresource} from './Webresource';
import {LicenseValidator} from './LicenseValidator';
import {Model} from './Model';

export class Generator {
public static generate(schematic: string, name: string): Promise<void> {
const supportedSchematics = ['entity', 'webresource', 'licensevalidator'];
const supportedSchematics = ['entity', 'webresource', 'model', 'licensevalidator'];
if (!shell.test('-e', 'src')) {
console.log(colors.red(`You are not inside the project Webresources folder!`));
} else if (!schematic) {
Expand All @@ -17,6 +18,8 @@ export class Generator {
return Entity.generateEntity(name);
} else if (schematic.toLowerCase() === 'webresource') {
return Webresource.generateWebresource(name);
} else if(schematic.toLocaleLowerCase() === 'model') {
return Model.generateModel(name);
} else if (schematic.toLowerCase() === 'licensevalidator') {
return LicenseValidator.generateLicenseValidator(name);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as colors from 'colors';
import * as shell from 'shelljs';
import {Variables} from './Variables';
import {Variables} from '../Variables';

export class LicenseValidator {
public static async generateLicenseValidator(licensename: string): Promise<void> {
Expand Down
Loading

0 comments on commit ce97914

Please sign in to comment.