Glued – Script Functions – Upload a File to a Flexible Asset
You can use a script function to upload a file to a flexible asset where the flexible asset type has a field for Upload.
Create a new script or open an existing one and add a new script step.
- Create a new script or open an existing one and add a new script step.
- From the function drop down, select Plugin Server Function.
- From the Function Guid, select “Glued – Upload File to Flexible Asset”.
- Enter the following:
- asset id – this is the asset id, not the flexible asset type id, and can be retrieved by using the “Get Flexible Asset Information” function if needed.
- field – this is the field name used in the flexible asset
- file path – this is the path to the file on the CWA server. Typically you would use the Upload File function to upload a file and reference the file with the %uploadedfile% variable.
- Save Step.
- When the step is run, it will upload the file from the specified path to the flexible asset. The file name for the upload will match that of the uploaded file. If the asset id or field name is invalid, or if the file path doesn’t exist, the function will log that information for troubleshooting.