Periodically upload files in Zoho Creator to Zoho Workdrive

Periodically upload files in Zoho Creator to Zoho Workdrive

Requirement

Perform integration between Zoho Creator and Zoho Workdrive, and use Schedules to upload files from Creator to Workdrive on a monthly basis .

Use Case  

A project tracker app maintains report files of finished projects in a form - Projects. At the beginning of each month, report files of the projects completed in the previous month will be submitted for audit. To achieve this, a schedule will be run at the end of each month to create a new folder for the current month and push all the relevant project reports to the newly created folder automatically.

see how it works

Steps to follow  

1. Create a form with the following details.
Form
Form Link Name
Field Type
Field Name
Field Link Name
Projects
Projects
Single Line
Company
Company
Single Line
Project title
Project_title
Single Line
Report
Report

This use case can be demonstrated using just the above-mentioned fields. You can include as many fields as required.
 
2. Create a connection with the following details.
This connection is used to authenticate the Zoho Workdrive account in which the files will be uploaded.

3. Create a schedule with the following details.
 
4. Click Add New Action > Deluge Script and add the following snippet:
  1. // Create a folder for the current month in Workdrive
  2. folder_name = "Audit_month-"+zoho.currenttime.getMonth();
  3. new_folder = zoho.workdrive.createFolder(folder_name, "oyw2o9aaeafa4c3e9421ca2ae4a8205d3c8c1", "workdrive_connection");

  4. // Fetch the ID of the new folder
  5. folder_id = new_folder.get("data").get("id");

  6. // Fetch the list of projects completed in current month
  7. projects_variable = Projects[End_date in this month];

  8. // Upload reports of the fetched projects to Zoho Workdrive
  9. for each rec in projects_variable
  10. {
  11.  response = zoho.workdrive.uploadFile(rec.Report, folder_id, rec.Project_title, false, "workdrive_connection");
  12. }

See how it works