Hello,
While adding attachments to notes record how to limit attachments to 5 from front end?
What is the best way to restrict attachments??
Hello,
While adding attachments to notes record how to limit attachments to 5 from front end?
What is the best way to restrict attachments??
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...
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.
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156