Hi Team,
I am trying to upload a file to a form in Zoho Creator. However, during the upload, an edit workflow is being triggered. I want to prevent this workflow from running, so I have used the skip_workflow
parameter as mentioned in the API documentation: Upload File API.
Despite including the skip_workflow
parameter in my request, the edit workflow is still getting triggered. Could you please help me understand why this is happening and provide a solution to prevent the workflow from being executed during the file upload?
This is my code for uploading file -
**void Profile.UploadImageIntoGharAndGharStudent(string downloadappName, string downloadreportName, string uploadappName, string uploadreportName, int downloadsystemId, string downloadFieldName, int uploadSystemId, string uploadFieldName)
{
// Parameters:
// - downloadappName: The app from which the photo is downloaded ("gharstudent")
// - downloadreportName: The report from which the photo is downloaded ("All_Profiles")
// - uploadappName: The app to which the photo is uploaded ("ghar")
// - uploadreportName: The report to which the photo is uploaded ("Ghar_Student_Report")
// - downloadsystemId: The system ID of the record to download the photo (input.ID)
// - downloadFieldName: The field name of the photo to download ("Photo")
// - uploadSystemId: The system ID of the record to upload the photo (input.Ghar_Student_SystemId)
// - uploadFieldName: The field name where the photo will be uploaded ("Photo")
// When calling this function - on Edit
// Base URL for the API
updateFlag = Profile[ID == uploadSystemId];
updateFlag.Flag="false";
url = "https://creator.zoho.in/api/v2.1/navgurukul/";
// Prepare HTTP headers
httpHeaders = Map();
if(thisapp.Helper.GetGharStudentEnvironmentProdDev("development"))
{
httpHeaders.put("environment","development");
httpHeaders.put("Content-Type","application/json");
}
else
{
httpHeaders.put("Content-Type","application/json");
}
// Construct URL to download the image
downloadUrl = url + downloadappName + "/report/" + downloadreportName + "/" + downloadsystemId + "/" + downloadFieldName + "/download";
// Perform the GET request to download the image
downloadedFile = invokeurl
[
url :downloadUrl
type :GET
headers:httpHeaders
connection:"ghar_connection"
];
// info "downloadedFile.......37";
// Set the file parameter for upload
downloadedFile.setParamName("file");
// info downloadedFile+"downloadedFile.......37";
Payload = Map();
skipWorkflowList = List();
skipWorkflowList.add("form_workflow");
skipWorkflowList.add("schedules");
Payload.put("skip_workflow",skipWorkflowList);
info Payload + "Payload.......45";
// parameters:Payload.toString()
// Construct URL to upload the image
uploadUrl = url + uploadappName + "/report/" + uploadreportName + "/" + uploadSystemId + "/" + uploadFieldName + "/upload";
// Perform the POST request to upload the image
uploadResponse = invokeurl
[
url :uploadUrl
type :POST
parameters:Payload
headers:httpHeaders
files:downloadedFile
connection:"ghar_connection"
];
info uploadResponse + "...58";
Looking forward to your assistance.
Thank you,
Kajal