Creator Simplified #11: Create a custom button to download files

Creator Simplified #11: Create a custom button to download files

Hey there!

This time, let's see how to create custom buttons to download the files uploaded in the file upload field.

Sample use-case

A training app has a module that provides the materials for all the available courses. Students can click on the corresponding button to download the required file.

Demo
  1. This report (All Course Materials) has a file upload field (Study Material). 



  2. Publish the report from the Operations module under the Manage section. Save the file path from the permalink generated.



  3. Create a custom button for a single record. 



  4. Add an action using the deluge script and create a new function. Copy the code given below. 

  1. openUrl("https://creatorapp.zohopublic.in/file" + zoho.appuri + "All_Course_Materials/" + input.ID + "/Study_Material/download/p5zQbOv7VkYtqsXd2uwBWHrzf5ZtyqfZ46N6FxP95ZR2EGHx7eJjv7YHkg4eMqSFdEqVWmVdhztSs7gRagBFAaddpkA5hJQRANkO?filepath=/" + input.Study_Material,"same window");


Here, the OpenURL () task redirects to a URL that allows you to download a file in the same window.

Let's break down the components of the URL.

creatorapp.zohopublic.in is the base URL to public components of Zoho Creator accounts in India. Change the domain as per your DC.

zoho.appuri populates the admin username and app link name in the URL.

All_Course_Materials is the report link name and input.ID dynamically fetches the ID of the record, and Study_Material is the field link name of the file upload field.

Paste the file path taken from the perma link, in this case it is p5zQbOv7VkYtqsXd2uwBWHrzf5ZtyqfZ46N6FxP95ZR2EGHx7eJjv7YHkg4eMqSFdEqVWmVdhztSs7gRagBFAaddpkA5hJQRANkO. 

  1. Finally, add the button to your report's quick view. 


Output



That's it! As easy as that!

Feel free to share your thoughts in the comment section below.

Thank you!