web
You’re offline. This is a read only version of the page.
close
Skip to main content
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??

I have the same question (0)
  • 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Sahan Hasitha Profile Picture

Sahan Hasitha 394

#2
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 123

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 103 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans