EmbeddedApp JS SDK file upload to ZFS

EmbeddedApp JS SDK file upload to ZFS

Hi, 

I ported the code from Deluge to EmbeddedApp JS SDK for the function to run in a widget. The pdf print of the template can be successfully retrieved but if it failed when uploading the content to ZFS. 

  1.     function Invoke() {
          var conn_name = "zoho_crm_templates_sendmail";
          var salesOrderId = "XXXXXXX000000470051";
          var templateId = "XXXXXXX000000410400";
          var req_data = {
            method: "GET",
            url:
              templateId +
              "/actions/print_preview?record_id=" +
              salesOrderId +
              "&print_type=pdf",
          };

         
          ZOHO.CRM.CONNECTION.invoke(conn_name, req_data).then(function (pdfdata) {        
            var formData = new FormData();
            var upload_data = {
            parameters: formData,
            headers: {
              "Content-Type": "multipart/form-data",
            },
            method: "POST",
            param_type: 2,
          };

            ZOHO.CRM.CONNECTION.invoke(conn_name, upload_data).then(function (data) {
              console.log(data)
            })
          });