I want to connect writer to zoho people enterprise. when writer mail merged template will be signed in zoho people I need these signed docs to be uploaded in zoho people personal records. what is the error in this function code?
Error Notification:
Your function seems to have a syntax error. Please check the Debug information and clear the error to continue.
response = mergeEventObj.get("response");
mergedDocs = response.get("mergedDocInfo");
for each mergeddoc in mergedDocs
{
merged_data = mergeddoc.get("data");
recordMap = Map();
recordMap.put("Name",merged_data.getJSON("Name"));
//Name - People form field label
recordMap.put("Phone_1",merged_data.getJSON("phone"));
//Phone_1- People form field label
recordMap.put("Email_ID_1",merged_data.getJSON("email"));
//Email_ID_1 - People form field label
// Downloading merged document - scopes needed - ZohoWriter.documentEditor.ALL, ZohoWriter.merge.ALL
downloadurl = mergeddoc.get("merged_document_url");
downloaded_doc = invokeurl
[
url :downloadurl
type :GET
connection:""
];
//To upload the files to people fields, we have to upload files using file upload api. This will return encrypted file path. Then we have to update this filepath to fields with insert/update record api.
// Scopes needed - ZohoPeople.files, ZohoPeople.forms
paramList = list();
paramMap1 = {"paramName":"uploadFile","content":downloaded_doc};
paramMap2 = {"paramName":"fieldName","content":"Resume","stringPart":"true"};
// Resume - people form file field label
paramList.add(paramMap1);
paramList.add(paramMap2);
form_name = "";
//form name in people
uploadedResponse = invokeurl
[
url :"https://people.zoho.com/people/api/forms/" + form_name + "/uploadFile"
type :POST
files:paramList
connection:""
];
filepath = uploadedResponse.get("response").get("result").get("encryptedfilepath");
recordMap.put("Resume",filepath);
// Resume - people form file field label
paramMap = Map();
paramMap.put("inputData",recordMap);
res = invokeurl
[
url :"https://people.zoho.com/people/api/forms/json/" + form_name + "/insertRecord"
type :POST
parameters:paramMap
connection:""
];
}