## Problem Description
We need to let users download contact information from CRM as CSV files to their local computers. Since we couldn't implement a direct download option, we're trying to use WorkDrive as a workaround - but we're encountering issues with the WorkDrive integration.
## Current Working Solution (Not Ideal)
We currently save the data as a note in CRM:
```javascript
string button.CRMtoJobBuilder1(String contact_id)
{
response = "";
contact_details = zoho.crm.getRecordById("Contacts",contact_id.toNumber());
if(contact_details != null)
{
// Format CSV data
note_content = "zcrm_" + contact_id + "," + contact_details.get("Last_Name") + "," +
contact_details.get("Full_Name") + "," + contact_details.get("Mailing_City") + "," +
contact_details.get("Mailing_State") + "," + contact_details.get("Mailing_Street") + "," +
contact_details.get("Mailing_Zip");
// Create note
noteMap = Map();
noteMap.put("Note_Title","CSV");
noteMap.put("Note_Content",note_content);
noteMap.put("Parent_Id",contact_id);
noteMap.put("$se_module","Contacts");
note_response = zoho.crm.createRecord("Notes",noteMap);
if(note_response.get("id") != null)
{
response = "Success";
}
else
{
response = "Error: " + note_response.toString();
}
}
else
{
response = "Contact not found";
}
return response;
}
```
## What We've Tried
### 1. WorkDrive Setup
- Created WorkDrive connection in Developer Space > Functions > Connections
- Selected required scopes:
- WorkDrive.files.READ
- WorkDrive.files.UPDATE
- WorkDrive.libraries.CREATE
- Connection shows active (green status)
- Have valid WorkDrive folder ID
### 2. Upload Attempts
The `uploadFile` method requires specific parameters:
```
uploadFile(FILE file, TEXT parent_id, TEXT fileName, TRUE/FALSE override-name-exist, TEXT connection)
```
We've tried multiple approaches:
1. Direct parameter passing:
```javascript
file_response = zoho.workdrive.uploadFile(fileContent, fileName, parentId);
// Error: No. of arguments mismatch
```
2. Using Map:
```javascript
upload_params = Map();
upload_params.put("parentId", folder_id);
upload_params.put("fileName", "test_connection.txt");
upload_params.put("content", "Test file content");
file_response = zoho.workdrive.uploadFile(upload_params);
// Error: No. of arguments mismatch
```
3. All parameters:
```javascript
file_response = zoho.workdrive.uploadFile(null, parent_id, fileName, false, "");
// Error: Argument type mismatches at index 1
```
4. Creating FILE type:
```javascript
testFile = file("test_connection.txt", fileContent);
// Error: Not able to find 'file' function
```
## Main Issues
1. Can't find documentation on creating a FILE type object in Deluge
2. Not clear if we're missing additional configuration for WorkDrive integration
3. Unable to determine if there's a simpler way to allow users to download contact data
## Questions
1. How do we properly create a FILE type object for WorkDrive.uploadFile?
2. Is there a better way to let users download contact data as CSV files?
3. Are we missing any crucial WorkDrive setup steps?
Any help or examples would be greatly appreciated!