Skip to content

Commit

Permalink
Readonly (#17)
Browse files Browse the repository at this point in the history
- Added functionality for the no action readme tags
Co-authored-by: Fernando Bo Gimenez <[email protected]>
  • Loading branch information
victorsolaya authored Nov 21, 2020
1 parent 0eacd91 commit bb62c8e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 33 deletions.
8 changes: 4 additions & 4 deletions MultiselectRecordsEntity/ControlManifest.Input.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<manifest>
<control namespace="VictorSanchez" constructor="MultiselectRecordsEntity" version="0.0.23" display-name-key="Multiselect Records Entity" description-key="Multiple selector for several records and insert in a string" control-type="standard">
<control namespace="VictorSanchez" constructor="MultiselectRecordsEntity" version="0.0.24" display-name-key="Multiselect Records Entity" description-key="Multiple selector for several records and insert in a string" control-type="standard">
<!-- property node identifies a specific, configurable piece of data that the control expects from CDS -->
<type-group name="textareas">
<type>SingleLine.Text</type>
Expand All @@ -22,6 +22,7 @@
</property>

<property name="openFormOptions" display-name-key="How do you want to open the form?" description-key="How do you want to open the form when you click the record?" of-type="Enum" usage="input" required="true">
<value name="noAction" display-name-key="No action" description-key="Disable the action">No action</value>
<value name="popup" display-name-key="As a popup" description-key="In a pop up">Pop up</value>
<value name="sameWindow" display-name-key="In the same window" description-key="In the same window">In the same window</value>
<value name="newWindow" display-name-key="In a new window" description-key="In a new window">In a new window</value>
Expand All @@ -36,8 +37,7 @@
<value name="false" display-name-key="False" description-key="false">False</value>
</property>
<property name="recordsToBeReturned" display-name-key="Amount of records to be shown as maximum" description-key="Set the number of records to be shown in the list as maximum. By default 50" of-type="Whole.None" usage="input" required="false" />



<resources>
<code path="index.ts" order="1"/>
</resources>
Expand All @@ -46,4 +46,4 @@
<uses-feature name="WebAPI" required="true" />
</feature-usage>
</control>
</manifest>
</manifest>
63 changes: 36 additions & 27 deletions MultiselectRecordsEntity/MultiselectRecords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,35 +331,44 @@ const getRecordsFromTextField = async () => {
Number.parseFloat(version[0] + "." + version[1]) >= 9.1 &&
Number.parseFloat(version[2] + "." + version[3]) >= 0.15631
) {

if(props.openWindow.toLowerCase() == "in a new window") {
(Xrm.Navigation as any).openForm({
entityName: logicalName,
entityId: id,
openInNewWindow: true
});
}else if(props.openWindow.toLowerCase() == "in the same window") {
(Xrm.Navigation as any).openForm({
entityName: logicalName,
entityId: id,
openInNewWindow: false
});
} else {
(Xrm.Navigation as any).navigateTo(
{
switch (props.openWindow.toLowerCase())
{
case "no action":
break;
case "in a new window":
(Xrm.Navigation as any).openForm({
entityName: logicalName,
entityId: id,
openInNewWindow: true
});
break;
case "in the same window":
(Xrm.Navigation as any).openForm({
entityName: logicalName,
entityId: id,
openInNewWindow: false
});
break;
default:
case "in a pop up":
(Xrm.Navigation as any).navigateTo(
{
entityName: logicalName,
pageType: "entityrecord",
formType: 2,
entityId: id,
},
{ target: 2, position: 1, width: { value: 80, unit: "%" } },
);
break;
}
} else {
if(props.openWindow.toLowerCase() != "no action") {
Xrm.Navigation.openForm({
entityName: logicalName,
pageType: "entityrecord",
formType: 2,
entityId: id,
},
{ target: 2, position: 1, width: { value: 80, unit: "%" } },
);
});
}
} else {
Xrm.Navigation.openForm({
entityName: logicalName,
entityId: id,
});
}
}

Expand Down Expand Up @@ -567,4 +576,4 @@ const getRecordsFromTextField = async () => {
);
}

export default MultiselectRecords;
export default MultiselectRecords;
2 changes: 1 addition & 1 deletion MultiselectRecordsEntity/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,4 @@ export class MultiselectRecordsEntity implements ComponentFramework.StandardCont
// Add code to cleanup control if necessary
ReactDOM.unmountComponentAtNode(this._container);
}
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ What have been the improvements with the previous version?

8. Header Visible (required)-> Set if the header will be visible in the list displayed.

9. Open Form Options (required) -> This allows you to choose how to open the record when you perform an onClick. Options are: Popup, New Window, Same Window.
9. Open Form Options (required) -> This allows you to choose how to open the record when you perform an onClick. Options are: Popup, New Window, Same Window or No Action.

10. Populated Field Visible (required)-> Set if the field that gets populated will be visible. **NOTE: As now it is a JSON I would suggest to always set is as False. (It is the first option to appear when you select the dropdown)**

Expand Down

0 comments on commit bb62c8e

Please sign in to comment.