diff --git a/AttachmentDragandDrop/Other/Solution.xml b/AttachmentDragandDrop/Other/Solution.xml index 057c0d8..aed4b61 100644 --- a/AttachmentDragandDrop/Other/Solution.xml +++ b/AttachmentDragandDrop/Other/Solution.xml @@ -7,23 +7,26 @@ - + + + + 1.0 2 - ramasolutions + ramakoneru - + - + - + https://github.com/ramarao9/ ram @@ -35,7 +38,7 @@ 1 - + USA @@ -49,7 +52,7 @@ 1 - + MN diff --git a/AttachmentUpload/ControlManifest.Input.xml b/AttachmentUpload/ControlManifest.Input.xml index 99473dd..c51b222 100644 --- a/AttachmentUpload/ControlManifest.Input.xml +++ b/AttachmentUpload/ControlManifest.Input.xml @@ -1,6 +1,6 @@ - SingleLine.Text diff --git a/AttachmentUpload/index.ts b/AttachmentUpload/index.ts index 78d37c7..e24903e 100644 --- a/AttachmentUpload/index.ts +++ b/AttachmentUpload/index.ts @@ -4,6 +4,11 @@ import { IInputs, IOutputs } from "./generated/ManifestTypes"; import { AttachmentUploader, UploadProps } from './AttachmentUploader'; + interface EntityRef { + id: string, + entityName: string +} + export class AttachmentUpload implements ComponentFramework.StandardControl { private UploadIconName: string = "uploadicn.png"; @@ -29,18 +34,13 @@ export class AttachmentUpload implements ComponentFramework.StandardControl, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container: HTMLDivElement) { - let currentPageContext = context as any; - currentPageContext = currentPageContext ? currentPageContext["page"] : undefined; - if (currentPageContext && currentPageContext.entityId) { - this.uploadProps.id = currentPageContext.entityId; - this.uploadProps.entityName = currentPageContext.entityTypeName; + let entityRef = this.getEntityReference(context); + if (entityRef) { + this.uploadProps.id = entityRef.id + this.uploadProps.entityName = entityRef.entityName; this.uploadProps.context = context; this.uploadProps.controlToRefresh = context.parameters.ControlNameForRefresh.raw; this.uploadProps.uploadIcon = this.getImageBase64(); - - // context.resources.getResource(this.UploadIconName, - // this.getImageResourceSuccess.bind(this, "png"), - // this.getImageResourceError.bind(this)); } this.attachmentUploaderContainer = container; } @@ -60,17 +60,32 @@ export class AttachmentUpload implements ComponentFramework.StandardControl): EntityRef | undefined { + let currentPageContext = context as any; + currentPageContext = currentPageContext ? currentPageContext["page"] : undefined; + if (currentPageContext && currentPageContext.entityId && currentPageContext.entityId !== "") { + var entityRef: EntityRef = { id: currentPageContext.entityId, entityName: currentPageContext.entityTypeName }; + return entityRef; + } + + return undefined; + + } + /** * Called when any value in the property bag has changed. This includes field values, data-sets, global values such as container height and width, offline status, control metadata values such as label, visible, etc. * @param context The entire property bag available to control via Context Object; It contains values as set up by the customizer mapped to names defined in the manifest, as well as utility functions */ public updateView(context: ComponentFramework.Context): void { this.uploadProps.context = context; - let currentPageContext = context as any; - currentPageContext = currentPageContext ? currentPageContext["page"] : undefined; - if (currentPageContext && currentPageContext.entityId) { - this.uploadProps.id = currentPageContext.entityId; + + let entityRef = this.getEntityReference(context); + if (entityRef) { + this.uploadProps.id = entityRef.id; + this.uploadProps.entityName = entityRef.entityName; } + this.uploadProps.uploadIcon = this.getImageBase64();//when initially a new record tha's transitioning to an existing record, so the UI is now being updated to enable the content + ReactDOM.render( React.createElement( AttachmentUploader, diff --git a/AttachmentUploader/.gitignore b/AttachmentUploader/.gitignore deleted file mode 100644 index 317e653..0000000 --- a/AttachmentUploader/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# msbuild output directories -/bin -/obj \ No newline at end of file diff --git a/AttachmentUploader/AttachmentUploader.cdsproj b/AttachmentUploader/AttachmentUploader.cdsproj deleted file mode 100644 index 7676497..0000000 --- a/AttachmentUploader/AttachmentUploader.cdsproj +++ /dev/null @@ -1,44 +0,0 @@ - - - - $(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\PowerApps - - - - - - - adfee3aa-0cb6-4c6c-b51a-a0cd26d9ecde - v4.6.2 - - net462 - PackageReference - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/AttachmentUploader/Other/Customizations.xml b/AttachmentUploader/Other/Customizations.xml deleted file mode 100644 index 9716685..0000000 --- a/AttachmentUploader/Other/Customizations.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - 1033 - - \ No newline at end of file diff --git a/AttachmentUploader/Other/Relationships.xml b/AttachmentUploader/Other/Relationships.xml deleted file mode 100644 index c22a38e..0000000 --- a/AttachmentUploader/Other/Relationships.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/AttachmentUploader/Other/Solution.xml b/AttachmentUploader/Other/Solution.xml deleted file mode 100644 index 61ae309..0000000 --- a/AttachmentUploader/Other/Solution.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - AttachmentUploader - - - - - - 1.0 - - 2 - - - ramasolutions - - - - - - - - - - - - ram - - 69998 - - -
- 1 - 1 - - - - - - - - - - - - - - - - 1 - - - - - - - - -
-
- 2 - 1 - - - - - - - - - - - - - - - - 1 - - - - - - - - -
-
-
- - -
-
\ No newline at end of file