Hello everyone, new here to Zoho CRM and Deluge.
The goal I am working towards is to create a folder with included subfolders when my company creates a new deal. I followed a very straightforward tutorial from Blungo on youtube which was working up until I realized that the folder that I needed to put my newly created folders into was too deep for my inexperience.
The folder structure is similar to this
1. Projects (base team folder)
1.1 Opportunities
*Shiny new folder*
The code I am working with is as follows:
DealInfo = zoho.crm.getRecordById("Deals",deal_id);
DealName = DealInfo.get("Deal_Name");
DealInfo2 = zoho.crm.getRecordById("Deals",num_id);
DealNo = DealInfo2.get("Zoho_ID");
info DealNo;
ParentFolderID = "66pdt2127fdfe30994611a242918bb25b17";
//ParentFolderID = "e8zc2572fc3aa0cb347408cf1c983812160d3";
// limiting the amount of characters because the Workdrive folder name has a limit
if(DealName.len() >= 40)
{
DealName = DealName.subString(0,40);
}
FolderName = DealNo + " | " + DealName;
// folder name - parent folder id - description - public - connection
Create_Team_Folder = zoho.workdrive.createTeamFolder(FolderName,ParentFolderID,"Description test",true,"crm_workdive");
//
info Create_Team_Folder;
Team_Folder_ID = Create_Team_Folder.get("data").get("id");
info Team_Folder_ID;
// // link folder as ATTACHMENT IN CRM ------------------------------------------------
dataList = List();
data = Map();
data.put("$link_url","https://workdrive.zoho.com/home/" + ParentFolderID + "/teams/" + ParentFolderID + "/ws/" + Team_Folder_ID + "/folders/files");
data.put("File_Name",FolderName);
data.put("$type","teamdrive");
dataList.add(data);
payload = "attachments=" + zoho.encryption.urlEncode({"data":dataList});
response = invokeurl
[
url :"https://www.zohoapis.com/crm/v3/Deals/" + deal_id + "/Attachments"
type :POST
parameters:payload
connection:"crm_workdive"
content-type:"application/x-www-form-urlencoded"
];
I found out that there are three different types of folder creation functions and that the folder ids are not very straightforward. When I use the team folder ID of the project folder, the program works but when I use the folder id of the opportunities folder, it doesn't work because there are two additional id's required to generate the url which doesn't even include the ParentFolderId.
I really don't want to make a new team folder now that I understand things a bit better but I don't know enough about deluge to be able to put the folder deeper into the folder hierarchy. Please help. Thank you in advance.