Attaching a file to bill in Zoho books

PHOTO EMBED

Fri Nov 15 2024 12:18:14 GMT+0000 (Coordinated Universal Time)

Saved by @RehmatAli2024 #deluge

attachment_resp = zoho.crm.getRelatedRecords("Attachments", "Token_Redemption", record_id);
// 			info attachment_resp;

for each file in attachment_resp
{
  id = file.get("id");
  info id;
  download_attachment = invokeurl
  [
    url: "https://www.zohoapis.eu/crm/v7/Token_Redemption/"+record_id+"/Attachments/"+id
    type: GET
    connection:"zoho_crm"
  ];
  info download_attachment;

  //download_attachment.setParamName("file");
  download_attachment.setParamName("attachment"); /// must include ///

  attach_to_bill = invokeUrl
  [
    url: "https://www.zohoapis.eu/books/v3/bills/412422000007051030/attachment?organization_id="+organization_id
    type: POST
    files: download_attachment
    connection: "zoho_books"
  ];
  info attach_to_bill;
}
content_copyCOPY