Dynamics Portal: Conditional show/hide of Edit/Delete button in Notes

Happy to connect with everyone on another exciting scenario.

User requested for hide the delete button in Notes if the record status is Submitted

I do not find any OutofTheBox option to achieve this. Then decided to use the Custom Javascript option in the Entity Forms to hide the delete control. 

Generally, we write Js code when DOM is ready. But it’s not working for this scenario.  Because notes control will take time to load the contents. 

How to achieve then? 

We need to look for an option to execute the code when the control completes the load.  I find that window. load function helps to achieve this requirement. 

if (window.jQuery) {
    (function ($) {
        $(document).ready(function () {
            //logic
        }),
        $(window).load(           
          $("a.delete-link").parent().closest('div').hide()
               )
    }(window.jQuery));
}

Hope this quick tip will help someone. 

If you need any help on Dynamics project and training, reach out to me. 

Do connect with me on LinkedIn and follow this blog to know more about Dynamics and its related stuff.

Happy to connect with you all through blogging. Do share your feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: