Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to limit adding to attachments to 5 for notes .

(0) ShareShare
ReportReport
Posted on by 483

Hello,

While adding attachments to notes record how to limit attachments to 5 from front end?

What is the best way to restrict attachments??

  • Mayank Pujara Profile Picture
    830 on at
    RE: How to limit adding to attachments to 5 for notes .

    as explained by other ppl earlier ..PreValidate plug in will make sense in this kind of scenario..

    check existing attachment list and if there are more then 5 then throw exception...

  • Suggested answer
    Ankit Sabharwal Profile Picture
    on at
    RE: How to limit adding to attachments to 5 for notes .

    Hello Partner,

    Hope this post finds you well.

    Unfortunately this configuration is not available in UI yet. In order to achieve it, you can register a plugin in pre create operation of annotation.

    In plugin logic, take the regarding object id and entity type and query the attachments for it. It will give you the collection, if it is greater than 5 then throw business process error that you cannot add more than 5 attachments.

    Make sure your plugin is register on synchronous mode.

    Thanks

    Hope this helps.

    Best regards,

    Ankit

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Verified answer
    meelamri Profile Picture
    13,216 User Group Leader on at
    RE: How to limit adding to attachments to 5 for notes .

    Hello,

    unfortunately you can do it from front end only with an unsupported way and it's need big effort:

    First, you create new field (attachementsCounter) to count attachement regarding your record. Then a plugin wish will increment this field by 1 when an attachement is created.

    Well, after that you need a JavaScript function. It execute onChange of  the new field (attachementCounter). This function will hide the button (unsupported) you need to manupilate the DOM !!

    Personnally, i will handle this scenario only in the back-end. I will use the field attachementsCounter. If i reach the limit i will throw an exception...

    Mehdi,

    Please tick as verified if the answer is useful. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 149 Super User 2025 Season 1

#2
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 53 Super User 2025 Season 1

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 32 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans