Need a daily backup of your Zoho Creator data? Store it in Dropbox

15.08.18 10:07 PM - By CreatorScripts

DropboxAPI

Zoho Creator does have an automatic weekly and monthly backups of all database details, but there is no way to create a daily backup. A solution is to leverage Dropbox API to send a copy of all records in a view to dropbox on a daily basis.

ZohoCreatorBackup

The Solution...

The solution is quite elegant. First, you need to send an email to a Form that will store the attachment you want to backup. You would then need a clever iteration setup to consider large number of records in a view. 


Below you can get the script for the file creation.


//FILE CREATION SCRIPT

void Dropbox.fileCreation()
{
getMaximumAuto = YOUR_FORM_NAME[ID != null].maximum(Auto_Number);
maxLoopN = getMaximumAuto / 3000;
i = 0;
for each  rec in YOUR_FORM_NAME
{
if(i >= maxLoopN)
{
break;
}
else
{
start = i * 3000;
end = (i + 1) * 3000;
sendmail
[
from :zoho.adminuserid
to :"formname@forms.zohocreator.com"
subject :"Records from zoho " + zoho.currenttime + " " + i
message :"Dropbox"
Attachments :view:YOUR_VIEW_NAME[Auto_Number >= start && Auto_Number <= end] as XLS
]
}
i = i + 1;
}
}


Second we need to send the file to Dropbox by executing the SendfiletoDropbox function on Add on Success of YOUR_VIEW_NAME 


getData = Dropbox[ID == input.recID];


Get the full script to integrate the Dropbox API to your Zoho Creator databases from our Deluge Scripts Library. If you need a Dropbox Account open one for free here. Dropbox Sign Up

CreatorScripts