I’m trying to set the mediaReference of an object (new or existing). The mediaReference is generated from a Workshop Upload form. The type of the property in the Code Repo is defined as “MediaItem” but this type doesn’t have a constructor so I cannot create it from a string. When I copy an existing mediaReference property from an existing object, I receive an error that the media reference cannot be set.
It seems like it is currently not possible to create an Object with a MediaReference property using TypeScript or even an Ontology Action. How am I supposed to create a Object with a mediaReference after an upload to a Media Set that was triggered by Workshop?
You’re correct that it currently isn’t possible to write to a media reference property via functions. However, that is currently in development, so you’ll be able to do this in the future. Additionally, the ability to create an object with a media reference property via an Ontology Action will be released in the next few weeks.
In the meantime, you could set up a pipeline to create objects from the media set. Using Pipeline Builder, you can start with your media set and use the ‘Convert media set to table rows’ board to generate a dataset from the media set. This dataset can then be used to create an object in Ontology Manager or even directly in Pipeline Builder. If you then go into the dataset that you created (that backs the object), you can add a schedule that runs whenever the parent resource (ie. the media set) updates.
This means that when an item is uploaded to the media set (via workshop or anywhere else), it will trigger the schedule to run, which will cause the backing dataset to update and therefore the new object(s) will appear.
Hopefully that helps, but please let me know if you have any other questions.
Hi Isy, thanks for the confirmation! We have tested the Pipeline Builder approach but unfortunately the slow build process is not acceptable in our use case. Keeping my eyes peeled for that release
Looking forward to this being deployed! Will enable some interesting workflows where you can process files on the fly through TypeScript and populate other properties at the same time.