- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2022 12:59 AM
I need way to rename an attachment when ever a new attachment is attached to form. can any one help me to acheive this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2022 03:15 AM - edited ‎10-25-2022 03:17 AM
Hi @Nikhil55 ,
You can write a before insert BR on sys_attachment table with below script :
Please make sure you select the table name for which you want this to happen else it will be a global change
You can use the below script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var name = "MyCustomName" // 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
})(current, previous);
I Hope this helps.
Please mark this helpful if this helps and Accept the solution if this solves your issue.
Regards,
Kamlesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2022 02:21 AM
Hi Nikhil,
Create an After insert business rule on sys_attachment table.
Add conditions so that it only triggers for your case table.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2022 02:30 AM
Hi @Edgar10 , Thank you for your response!
Can you please provide sample script if you are having. It will be helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2022 03:15 AM - edited ‎10-25-2022 03:17 AM
Hi @Nikhil55 ,
You can write a before insert BR on sys_attachment table with below script :
Please make sure you select the table name for which you want this to happen else it will be a global change
You can use the below script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var name = "MyCustomName" // 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
})(current, previous);
I Hope this helps.
Please mark this helpful if this helps and Accept the solution if this solves your issue.
Regards,
Kamlesh