How to prevent duplicate attachments in UI builder when using attachment component.

Hm10
Tera Contributor

I have used this attachment component in UI builder. How to prevent user from adding duplicate attachments ?

Hm10_0-1708329340067.png

 

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Hm10 

 

When you say duplicate, are you referring to file name or content too? 

 

OOTB there is no way to do this, you need to write code to check the name and validate. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

hi @Dr Atul G- LNG 

Thanks for replying. Currently I want to prevent duplicate file name.

Actually I am new to UI builder. I want to know, how to validate this in UI builder and script?
 I created a business rule on sys_attachment table to abort duplicate attachment. It is working as expected but there are no errors displaying on the UI builder page for this.

How can we show error messages on abort action business rule to UI builder page ?

Hi @Hm10 

 

Its very New to me  too,

try to check here

 

https://www.servicenow.com/community/itsm-forum/error-message-is-not-displaying-when-action-is-abort...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************