web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

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

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

I have the same question (0)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    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.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    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.

  • Verified answer
    ashlega Profile Picture
    34,477 on at

    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
    prt33k Profile Picture
    6,907 on at

    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

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans