How to restrict the image file to upload in employee profile page when fill exceeds 300 kb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2024 02:38 AM
I've been assigned a task to restrict the upload of a profile cover image on the Employee Profile page in the Employee Center if the file size exceeds 300 KB. I'm using the Employee Profile Header widget to implement this functionality. If the file size exceeds the limit, an error message should appear indicating that the file size has been exceeded.
Writing a Business Rule on the table is not allowed for this requirement.
Could anyone suggest the best practices or approaches to validate the file size and meet this requirement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2024 03:54 AM
you need to customize OOB widget or clone the OOB one and handle your logic
are you referring to this one?
if yes then you will have to clone the User Profile widget and make the changes
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2024 07:47 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2024 07:48 PM
you can try to use before insert BR on sys_attachment but you told BR is not allowed
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2024 02:55 AM
Why not use a BR for this? Check the size and abort action, with a message. It's an easy thing to do.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2024 12:19 AM
Hi @Mark Manders ,
I tried implementing this with a Business Rule, but it's not working as expected. While I can see the message on the platform side, it doesn't appear in the portal view. Additionally, I attempted to abort the action, but it doesn't stop the image from being uploaded.
Below is the script I used:
