Is it possible to create a function backed action to upload media in media reference property in object set.
Requirement - User will upload the media in media reference property using button in workshop. Filename generated when user upload the file should be the primary key value.
Current solution - User are uploading the media in media reference property and copying the filename generated after upload in primary key property. This is done using action in ontology manager.
Need to provide a solution to do this automatically copying the filename into the primary key property.
Next step - User can upload multiple files and action should copy the filename and put in the primary key property.
Yes, it is now possible to upload media via a function-backed action.
The docs here show how to set up a workflow for uploading media as you described: https://www.palantir.com/docs/foundry/media-sets-advanced-formats/upload-media
If you want to create a function-backed action, simply choose your function when creating the action.
There are also docs here for using media references in TypeScript v1 functions: https://www.palantir.com/docs/foundry/functions/media
I have tried with multiple code snippet to upload the raw pdf file in media reference property but it is not working. I am not able to set the input data type for my medireference property, checked with mediaitem, mediaitemdatatype etc.
The shared documentation does not provide information on the upload media using function.
Any inputs on how to upload raw pdf file using function and taking the generated filename of the uploaded file in the primary key will be highly appreciated.
so in typescript function you just need to use parameter in example document: MediaItem to pass to your function and later just assign this document to media reference property
as
uploadMedia.uploadTestingMedia = document;
. And it works just in typescript v1. I was creating uuid as different property in the object.