Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to restrict the image file to upload in employee profile page when fill exceeds 300 kb

Aditya02
Tera Guru

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?

11 REPLIES 11

Mark Manders
Mega Patron

Can you explain why the options that have been provided won't work for you? The requirement is to limit the size of the attachment. Use of a BR or customizing the widget are provided as answers and you are only asking for other ways to do so? What is the limitation? Why can't you just use a BR? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Mark Manders
Mega Patron

Put some logs in that BR to see where it goes wrong. 

Why is the 'if' statement in there at the start? Does the BR reach that 'if'? A before BR on the attachment table for the table should be enough to just validate the size and then abort the upload. I don't know where your BR is failing, because I don't know your instance.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark