Need a recipe for fileupload. Store uploaded file in documents folder and the document Id to be stored in DB table.

 Need a recipe for fileupload. Store uploaded file in documents folder and the document Id to be stored in DB table. To facilitate an API GET type, to retrieve uploaded document with document Id.

Please an example recipe. I have tried using fileUpload component and used a!writetoDataStoreEntity() as follows and it is throwing an error stating the valueToStore cannot be null, when trying to upload a file.

Error for the below code is:

Could not display interface. Please check definition and inputs.

Interface Definition: Expression evaluation error: An error occurred while executing a smart service: An error occurred while trying to convert the given data to the type of the specified entity “Technologies” [id=db1da466-b3a3-4e93-bd4a-81566d516b20@4053, type=Technologies (id=2670)] (data store: Radar_DataStore). Value that could not be converted: ActivityClassParameter[name=DynamicInputs,it=3,v=[Document:4089]] Details: Could not cast from Text to Technologies. Details: CastInvalid (APNX-1-4400-000) This error will not be displayed to the user viewing this form. Click here to dismiss the error message and see the resulting interface.

 

Need to store only Document Id on DB not the image itself. Image should be stored in folder configured on the fileUpload component.

 

=load(
a!gridLayout(
label: "",
instructions: "This is a grid layout",
headerCells: {
a!gridLayoutHeaderCell(label: "Image")
},
rows: {
a!gridRowLayout(
contents: {
a!fileUploadField(
helptooltip: "Upload Technology image Files",
target: cons!ImagesFolder_Constant,
value: ri!Image.Image,
/*error("Unable to Store Uploaded Image")*/
saveInto: a!save(ri!Image.Image, save!value)
)
}
)
}
)
)

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data