Skip to content

Commit

Permalink
Added Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Sanchez authored and Victor Sanchez committed Oct 12, 2020
1 parent 8479f48 commit 60ba208
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CardViewer/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="CardViewer" version="0.0.14" display-name-key="CardViewer" description-key="CardViewer description" control-type="standard">
<control namespace="VictorSanchez" constructor="CardViewer" version="0.0.1" display-name-key="CardViewer" description-key="CardViewer description" control-type="standard">
<!-- dataset node represents a set of entity records on CDS; allow more than one datasets -->
<data-set name="dataset" display-name-key="Dataset" cds-data-set-options="displayCommandBar:true;displayViewSelector:true;displayQuickFindSearch:true">
<!-- 'property-set' node represents a unique, configurable property that each record in the dataset must provide. -->
Expand Down
Binary file added CardViewer/assets/configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CardViewer/assets/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 4 additions & 10 deletions CardViewer/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { IInputs, IOutputs } from "./generated/ManifestTypes";
import * as mockData from "./fakeJson.json";
import CardView from "./Card";
import * as React from "react";
import * as ReactDOM from "react-dom";
Expand Down Expand Up @@ -47,10 +46,9 @@ export class CardViewer implements ComponentFramework.StandardControl<IInputs, I
context: ComponentFramework.Context<IInputs>,
entityName: string,
field: string,
isFake: boolean,
): Promise<void> {
this._container.innerHTML = "";
const objectCountAndName: [MetadataObject] = await this.getJsonObjectUtils(context, entityName, field, isFake);
const objectCountAndName: [MetadataObject] = await this.getJsonObjectUtils(context, entityName, field);
ReactDOM.render(React.createElement(CardView, objectCountAndName), this._container);
}

Expand All @@ -61,7 +59,7 @@ export class CardViewer implements ComponentFramework.StandardControl<IInputs, I
fieldName = entityRecord._columnAliasNameMap.optionSetField;
}

this.runMain(context, context.parameters.dataset.getTargetEntityType(), fieldName, false);
this.runMain(context, context.parameters.dataset.getTargetEntityType(), fieldName);
}

private async retrieveRecords(context: ComponentFramework.Context<IInputs>, entityName: string, options: string) {
Expand Down Expand Up @@ -102,13 +100,9 @@ export class CardViewer implements ComponentFramework.StandardControl<IInputs, I
context: ComponentFramework.Context<IInputs>,
entityName: string,
field: string,
isFake: boolean,
): Promise<[MetadataObject]> => {
let objectCountAndName: [MetadataObject] = [{}] as [MetadataObject];
if (isFake) {
objectCountAndName = mockData as [MetadataObject];
return objectCountAndName;
}
const objectCountAndName: [MetadataObject] = [{}] as [MetadataObject];

const metadata = await context.utils.getEntityMetadata(entityName, [field]);
const values: any = Object.values(metadata.Attributes.get(field).OptionSet);
let fetchXmlFromView = await context.webAPI.retrieveRecord("savedquery", context.parameters.dataset.getViewId());
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Multiselect Records

## Description

This control has been created to select many records from an entity.
What this will do is to insert the data split by the delimiter you have selected in your control in the single text field this is attached.
This can be useful to retrieve a "list of records" from a single field and it can be used in a plugin.

## Download

[DOWNLOAD LATEST RELEASE](https://github.com/victorsolaya/CardViewer/releases/latest)

## How to configure

1. Add the control to the view that you want to show the cards.

## Parameters

1. Option Set Field -> Field that is going to be used for showing the different options

## Filter

This is filtered based on the filter criteria of the system view.

## Example of configuration

![Form configuration](assets/configuration.png)

## Demo

![Demo](assets/demo.png)

## Issues / Questions

If you have any questions or issues regarding this control, please, raise an issue in github or send me an email: [email protected]

0 comments on commit 60ba208

Please sign in to comment.