upload attachment to Zoho books bill from Zoho CRM

upload attachment to Zoho books bill from Zoho CRM


I have a document stored in a file field in CRM (module reservation)
I am trying to attach this document to the bill created in Zbooks using Deluge, but I keep having issue, either File is empty or {"code":2,"message":"The request passed is not valid."
Please see below the function written. Any help would be really nice!

Org = "XXXX";
resaID = 1111111111;
ResaDetails = zoho.crm.getRecordById("Reservations1",resaID);
Invoice_crm = ResaDetails.get("Invoice");
attachment_Id = Invoice_crm.getjson("attachment_Id");

//test invoice Zbooks to which file must be attached
IDinvoice_Zbooks = 222222222222;

download_inv_File = invokeurl
url :"https://www.zohoapis.com/crm/v2/Reservations1/" + resaID + "/Attachments/" + attachment_Id
type :GET
files = list();

Upload_file_Zbooks = invokeurl
url :"https://books.zoho.com/api/v3/bills/" + IDinvoice_Zbooks + "/attachment?organization_id=" + Org
type :POST
files : files
info Upload_file_Zbooks;

    Zoho Marketing Automation

            Zoho Pagesense Resources

              Zoho SalesIQ Resources

                    Zoho TeamInbox Resources

                      Zoho DataPrep Resources

                        Zoho CRM Plus Resources

                          Zoho Books Resources

                            Zoho Subscriptions Resources

                              Zoho Desk Resources

                                Zoho Projects Resources

                                  Zoho Sprints Resources

                                    Qntrl Resources

                                      Zoho Creator Resources

                                        Zoho WorkDrive Resources

                                            Zoho Campaigns Resources

                                              Zoho CRM Resources

                                                      Design. Discuss. Deliver.

                                                      Create visually engaging stories with Zoho Show.

                                                      Get Started Now