how to make a downloaded file has file name + file extension in its name?
I want to download the file from 'File Upload' Field in Zoho CRM, after download the file then I will upload it to our own image server to create a download URL link. I wrote the code below.
but the problem is, the file name doesnt have file extension in it. so how to include a file name + file extension in the downloaded file name?
here is the code I use:
- // fetch CRM Deal Details
- v_Module = "Deals";
- v_dealID = DEAL_ID;
- v_Endpoint = "https://www.zohoapis.com/crm/v7/" + v_Module + "/" + v_dealID;
- r_DealDetails = invokeurl
- [
- url :v_Endpoint
- type :GET
- connection:"zoho_crm_connections"
- ];
- m_DealDetails = ifnull(r_DealDetails.get("data").toMap(),Map());
- if(!isNull(m_DealDetails.get("Product_Attachment")))
- {
- l_Files = List();
- for each m_FileUpload in m_DealDetails.get("Product_Attachment")
- {
- // get files from Zoho CRM
- v_FileDownloadUrl = "https://www.zohoapis.com/crm/v7/files?id=" + m_FileUpload.get("File_Id__s");
- v_FileName = m_FileUpload.get("File_Name__s"); // I am trying to get name and extension in here
- f_MyFile = invokeurl
- [
- url :v_FileDownloadUrl
- type :GET
- connection:"zoho_crm_connections"
- ];
- f_MyFile.setParamName("file_data");
- f_MyFile.setFileName(v_FileName); // set the file name in here but it doesnt work
- l_Files.add(f_MyFile);
- }
- if(!l_Files.isEmpty())
- {
- first_file = l_Files.get(0);
- // send first file only to Blueray Server
- bodyMap = Map();
- bodyMap.put("file_data",first_file);
- fileResponse = invokeurl
- [
- url :"https://myAPI.com/file/upload"
- type :POST
- parameters:bodyMap
- ];
- file_url = fileResponse.get("file_url");
- // update the field in deal module
- update = {"Product_Attachment_URL":file_url};
- zoho.crm.updateRecord("Deals",DEAL_ID,update);
- }
- }
Access your files securely from anywhere
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Sticky Posts
Focus Group Webinar - Streamline Record Creation with Wizards
Hi there, With all the time your users spend on record creation, do you feel like they have the most seamless experience while doing it? For different types of records or those with a LOT of fields, do your users spend time navigating to enter data repeatedly?
Notes and Attachments visibility can now be restricted based on profiles
Dear All, We hope you're well! We are here with a quick update about Notes and Attachments profile permissions. In the past, a record's Notes and Attachments were visible by default to all users with record access. However, as notes and attachments can
Identify and prioritize profitable deals: Zoho CRM Forecasts help users focus on revenue-driving opportunities
Post moderated on: 7th November: Release update: This feature is now available for users in all DCs. Dear Customers, We hope you're well! At any given time, a sales rep handles multiple deals, each progressing at its own pace. But not all deals will succeed—some
Gain control over record sharing with portal users through our new enhancement: criteria-based data exposure
Dear Customers, We hope you're well! Portals is a self-service avenue through which your clients can access and manage their direct and related data in Zoho CRM. This empowers them to be more independent and enables them to experience a sense of transparency
Context and convenience just got better with Zia's email intelligence
Dear Customers, We hope you're well! We are in 2024, and email as a tool is only getting more powerful each day. While it enables seamless daily correspondences, we are here with a set of abilities that will enhance your user experience and save several
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.