Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

This code is written in the HDEB-10 (Code + Metadata) Attachments.zip →DownloadAttachment.json file.

...

Info

This code is also written in HDEB-10 (Code + Metadata) Attachments.zip → DownloadAttachment.json file.

...

Info

This code is written in HDEB-10 (Code + Metadata) Attachments.zip → FileUpload.json file.


Code Block
languagejs
titleJSON - Upload
collapsetrue
"UploadFile": {
    "parent": {
      "name": "getSingleProfilePerson"
    },
    "route": {
      "httpMethod": "POST",
      "segments": {
        "UploadAttachment": {
          "isLiteral": true,
          "type": "string"
        }
      }
    },
    "inputEntityDefinition": null,
    "outputEntityDefinition": null,
    "businessLogic": {
      "MultiPartFormDataReaderPF": {
        "executionType": "processFlow",
        "processFlowProperties": {
          "processFlowName": "MultiPartFormDataReader Process Flow",
          "processFlowParameters": {
          }
        }
      },
      "MultiPartFormDataContentTypeValidatorPF": {
        "executionType": "processFlow",
        "processFlowProperties": {
          "processFlowName": "MultiPartFormDataContentTypeValidator Process Flow",
          "processFlowParameters": {
            "MultiPartFormDataObject": "@parent.MultiPartFormDataReaderPF.outputMultipartFormDataObject",
            "ValidMimeTypes": "image/jpg,image/png"
          }
        }
      },
      //POC
      "AttachmentPF": {
        "executionType": "processFlow",
        "processFlowProperties": {
          "processFlowName": "Test Attachment PF",
          "processFlowParameters": {
            "FileData": "@parent.MultiPartFormDataReaderPF.outputMultipartFormDataObject",
            "RecordId": "@request.Id",
            "EntityName": "Persons", //Hardcoded for POC
            "CategoryId": 1 //DOB Category ID, Hardcoded for POC
          }
        }
      }

      /*
		,
        "MultiPartFormDataCleanupPF": {
          "executionType": "processFlow",
          "processFlowProperties": {
            "processFlowName": "MultiPartFormDataCleanup process flow",
            "processFlowParameters": {
              "MultiPartFormDataObject": "@parent.MultiPartFormDataReaderPF.outputMultipartFormDataObject"
            }
          }
        }		
		*/
    }
  }

This endpoint uses the "Test Attachment PF” process flow which is under HDEB-10 (Code + Metadata) Attachments.zip → HDEB-10_PF_TestAttachment.cmpack.

...

You can find the Stored Procedure under HDEB-10 (Code + Metadata) Attachments.zip → HDEB-10_SPs.cmpack.

This code block is written in "..\eBusiness\json\metadata\v1\Common\security.json". This executes the above security function with the required parameters.

...

Follow the below given steps to deploy the above mentioned POC example.

  1. Extract the files from HDEB-10 (Code + Metadata) Attachments.zip.
  2. Unpack the PF's and DBO's CMPacks using CM tool.
  3. Paste FileUpload.json and DownloadAttachment.json files under “..\eBusiness\json\metadata\v1\Endpoints\ProfilePersons” folder.

...

4. The above three endpoints are registered under HDEB-10 (Code + Metadata) Attachments.zip → ProfilePersonEndpoint.json file.

...

5. Add the class 'AttachmentComponent.cs' from HDEB-10 (Code + Metadata) Attachments.zip  under 'MultipartFormDataProcessFlows' project in Visual Studio.

...