Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to stop a user not to edit or attach documents based on a form field value

Posted on by

Hi Experts,

We have a requirement not to allow user to edit or attach documents to a custom Entity based on form field condition, in other conditions he should be able to attach documents. I tried to disable the Notes section using JavaScript but its not working. Any ideas/suggestions

Thanks,

Shaik

*This post is locked for comments

  • Suggested answer
    prt33k Profile Picture
    prt33k 6,907 on at
    RE: How to stop a user not to edit or attach documents based on a form field value

    Not a clean way of doing it however you can throw error whenever use try to upload attachment and if the required field is has certain value using a plugin. Just write a plugin on attachment create and check if the parent field is set to certain vlaue then throw exception.

    The other way will be to have two seperate form - one with Notes tab and one without the tab. You need to swtich the form based on field value but then this is also not very secure and cause flicker.

    Thanks,

    Prateek

  • Verified answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: How to stop a user not to edit or attach documents based on a form field value

    Not sure if you want to actually hide the notes, or if you just need to stop users from adding more notes..

    For hiding, Ravi and Aric have covered it (javascript)

    As for preventing the users from adding more notes/doing anything with the existing notes, the simplest no-code solution might be to create a real-time workflow: register it on the note entity, check the conditions, then add "stop workflow" step (use "cancelled" status) and specify the message you want to display in the properties of that workflow step

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How to stop a user not to edit or attach documents based on a form field value

    Hi,

    You cannot hide the notes control but you can hide the section under which you have placed the notes control.

    Something like this-

    Xrm.Page.ui.tabs.get("tabname").sections.get("sectionname").setVisible(false);

    Hope it helps.

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: How to stop a user not to edit or attach documents based on a form field value

    There is no real way to disable the notes control in a supported way.

    The options that you have are as follows:

    - Hide the section where the notes reside based on the value of the field.

    - Add a pre-operation Create/Update message to the Notes (annotation) entity, and check for the value of the field. Based on that value, you can throw an exception if the user tries to Create/Update a note and should not.

    Good luck.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans