Skip to content

Commit

Permalink
Merge pull request #7 from cathalnoonan/features/v2
Browse files Browse the repository at this point in the history
v2.0.0 - Remove undocumented 'context.page' to get the entityId / entityLogicalName
  • Loading branch information
cathalnoonan authored Aug 3, 2022
2 parents d272175 + 5ed2c5e commit 46ba063
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 53 deletions.
12 changes: 8 additions & 4 deletions control/ProcessSessions/ControlManifest.Input.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<manifest>
<control namespace="Cathal" constructor="ProcessSessions" display-name-key="ProcessSessions_Display_Key" description-key="ProcessSessions_Desc_Key" control-type="standard"
version="1.1.2">
version="2.0.0">

<property name="field" display-name-key="Field_Display_Key" description-key="Field_Desc_Key" of-type-group="any" usage="bound" required="true" />


<!-- Entity reference parameters -->
<property name="entityId" display-name-key="entityId_Display_Key" description-key="entityId_Desc_Key" of-type="SingleLine.Text" usage="bound" required="true" />
<property name="entityLogicalName" display-name-key="entityLogicalName_Display_Key" description-key="entityLogicalName_Desc_Key" of-type="SingleLine.Text" usage="input" required="true" />

<type-group name="any">
<type>Currency</type>
<type>DateAndTime.DateAndTime</type>
Expand Down Expand Up @@ -45,8 +49,8 @@

<resources>
<code path="index.ts" order="1"/>
<resx path="strings/ProcessSessions.1030.resx" version="1.1.2" />
<resx path="strings/ProcessSessions.1033.resx" version="1.1.2" />
<resx path="strings/ProcessSessions.1030.resx" version="2.0.0" />
<resx path="strings/ProcessSessions.1033.resx" version="2.0.0" />
</resources>

<feature-usage>
Expand Down
7 changes: 3 additions & 4 deletions control/ProcessSessions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class ProcessSessions implements ComponentFramework.StandardControl<IInpu
}

public updateView(context: ComponentFramework.Context<IInputs>): void {
this.assignEntityReference(context)
this.render()
}

Expand All @@ -42,10 +43,8 @@ export class ProcessSessions implements ComponentFramework.StandardControl<IInpu
}

private assignEntityReference(context: ComponentFramework.Context<IInputs>): void {
// TODO: Remove cast to <any>
const { entityId, entityTypeName } = (<any>context).page
this.entityId = entityId
this.entityTypeName = entityTypeName
this.entityId = context.parameters.entityId?.raw!
this.entityTypeName = context.parameters.entityLogicalName?.raw!
}

private getWorkflowService(context: ComponentFramework.Context<IInputs>): IWorkflowService {
Expand Down
12 changes: 12 additions & 0 deletions control/ProcessSessions/strings/ProcessSessions.1030.resx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@
<data name="Field_Desc_Key" xml:space="preserve">
<value>Felt, der bruger kontrollen</value>
</data>
<data name="entityId_Display_Key" xml:space="preserve">
<value>Entity ID</value>
</data>
<data name="entityId_Desc_Key" xml:space="preserve">
<value>Indstil denne værdi til enhedens primære nøglefelt (felt, der indeholder GUID- eller UNIQUEIDENTIFIER-værdien).</value>
</data>
<data name="entityLogicalName_Display_Key" xml:space="preserve">
<value>Entity Logical Name</value>
</data>
<data name="entityLogicalName_Desc_Key" xml:space="preserve">
<value>Indtast det logiske navn på enheden her.</value>
</data>
<data name="ProcessType_Display_Key" xml:space="preserve">
<value>Type</value>
</data>
Expand Down
12 changes: 12 additions & 0 deletions control/ProcessSessions/strings/ProcessSessions.1033.resx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@
<data name="Field_Desc_Key" xml:space="preserve">
<value>Field that will use the control</value>
</data>
<data name="entityId_Display_Key" xml:space="preserve">
<value>Entity ID</value>
</data>
<data name="entityId_Desc_Key" xml:space="preserve">
<value>Set this value to the primary key field of the entity (field containing the GUID or UNIQUEIDENTIFIER value).</value>
</data>
<data name="entityLogicalName_Display_Key" xml:space="preserve">
<value>Entity Logical Name</value>
</data>
<data name="entityLogicalName_Desc_Key" xml:space="preserve">
<value>Type the logical name of the entity here.</value>
</data>
<data name="ProcessType_Display_Key" xml:space="preserve">
<value>Process Type</value>
</data>
Expand Down
4 changes: 2 additions & 2 deletions control/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 control/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pcf-processsessions",
"version": "1.1.2",
"version": "2.0.0",
"license": "MIT",
"scripts": {
"build": "pcf-scripts build",
Expand Down
6 changes: 6 additions & 0 deletions docs/building.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Building

The solution can be built by double clicking the `build.bat` file at the root of the repository
- This will install the npm dependencies using `npm`
- Then it will build the solution (which will in turn build the control) using `dotnet`
- The resulting solution(s) will be built to `dist` in the repo root as a zip file
34 changes: 34 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Configuration

When adding the control to a field, drag an unused field onto the form in it's own section

The control behaves as an unbound control in that it does not use the value field it is bound to in any way, so it doesn't matter what field is used for the control

Un-check the `"Display label on the form"` field on the first tab

The control can be bound to any of the following field types, these are the types supported by the framework
- Currency
- DateAndTime.DateAndTime
- DateAndTime.DateOnly
- Decimal
- Enum
- FP
- Multiple
- OptionSet
- SingleLine.Email
- SingleLine.Phone
- SingleLine.Text
- SingleLine.TextArea
- SingleLine.Ticker
- SingleLine.URL
- TwoOptions
- Whole.None

The following configuration values are required to render the control

| Name | Description |
|:--- |:--- |
| Field | Field that the control will be bound to |
| Process Type | Type of process sessions to include in the control |
| Entity ID | Bind to the Primary ID field of the entity |
| Entity Logical Name | Type the logical name of the entity |
22 changes: 22 additions & 0 deletions docs/migration-v1-v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Migration from V1 to V2

After importing the V2 (or higher) solution to the environment, the control
configuration needs to be updated to add the new properties.

The new properties added in this version are:
- Entity ID
- Entity Logical Name

To add the new properties, find the forms where the control is used, and double
click on the control.

Set the `Entity ID` property to the primary ID field of the entity:
- i.e. for "Account", this will be "accountid"
- i.e. for "Contact", this will be "contactid"

Set the `Entity Logical Name` property to the logical name of the entity:
- i.e. for "Account", this will be "account"
- i.e. for "Contact", this will be "contact"

Save and publish the form, and make sure the changes are deployed to your other
environments after the control is imported.
46 changes: 5 additions & 41 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,18 @@ Double clicking on a record in the grid will open the details of that process se

![Banner image](images/banner.png)

---

## Downloads

Download a managed solution from the [releases page](https://github.com/cathalnoonan/d365-pcf-processsessions/releases)


## Configuration

When adding the control to a field, drag an unused field onto the form in it's own section

The control behaves as an unbound control in that it does not use the value field it is bound to in any way, so it doesn't matter what field is used for the control

Un-check the `"Display label on the form"` field on the first tab

The control can be bound to any of the following field types, these are the types supported by the framework
- Currency
- DateAndTime.DateAndTime
- DateAndTime.DateOnly
- Decimal
- Enum
- FP
- Multiple
- OptionSet
- SingleLine.Email
- SingleLine.Phone
- SingleLine.Text
- SingleLine.TextArea
- SingleLine.Ticker
- SingleLine.URL
- TwoOptions
- Whole.None

The following configuration values are required to render the control

| Name | Description |
|:--- |:--- |
| Field | Field that the control will be bound to |
| Process Type | Type of process sessions to include in the control |


---

## Building

The solution can be built by double clicking the `build.bat` file at the root of the repository
- This will install the npm dependencies using `npm`
- Then it will build the solution (which will in turn build the control) using `dotnet`
- The resulting solution(s) will be built to `dist` in the repo root as a zip file
## Docs
- [Configuration](docs/configuration.md)
- [Migration from V1 to V2](docs/migration-v1-v2.md)
- [Building](docs/building.md)

---

Expand Down
2 changes: 1 addition & 1 deletion solution/src/Other/Solution.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<LocalizedName description="Process Sessions" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<Version>1.1.2</Version>
<Version>2.0.0</Version>
<!-- Solution Package Type: Unmanaged(0)/Managed(1)/Both(2)-->
<Managed>2</Managed>
<Publisher>
Expand Down

0 comments on commit 46ba063

Please sign in to comment.