How to upload a file and rename an attachment using a UI action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2023 06:14 PM
Hello,
I want to upload a file and after uploading the file, change the file name to "Doc" + file extension.
I have this script but when I add something after "saveAttachment(g_form.getTableName(), g_form.getUniqueValue());" it doesn't run.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2023 09:05 PM
Hello @Ed23
var name = "Doc" // You can set the value as per your requirement
var extensionName = current.getValue("file_name").split(".")[1]; //Retrieves the extension of file your are uploading
current.file_name = name + "." + extensionName // Renaming the uploaded file along with it's extension
Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2023 10:53 AM - edited 07-16-2023 10:53 AM
Hello @Samaksh Wani ,
Thanks for your reply, how can I get it to run on the UI Action after line 3? "saveAttachment(g_form.getTableName(), g_form.getUniqueValue());"?
I want to create a UI Action to upload files and that all files uploaded through that UI Action are automatically renamed to "DOC".
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2023 10:09 PM
Hello @Ed23
You need to add the above mentioned script in the script box of UI Action Thats it.
Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2023 11:11 PM
Hello @Ed23
Uncheck the Box of Client in UI Action and Copy paste the above mention code as it in Script box of your UI Action, Erase everything what you wrote.
Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Samaksh