Tuesday, August 23, 2011

Disabling Notes for deactivated records, read only or any condition MS CRM 2011

The HelpKindle 3G, Free 3G + Wi-Fi, 3G Works Globally, Graphite, 6" Display with New E Ink Pearl Technology - includes Special Offers & Sponsored ScreensaversSome times we have requirements like on basis of some logic, or on basis of the record type, like if its disabled(inactive) or readonly then the notes needs to be disabled.
Even if this is unsupported, this will work to full fill the requirement
just paste the below code on laod of the JS and call the function(form_onload) from onload

function form_onload(){
if (Xrm.Page.ui.getFormType() == 4) // suppose i have taken the condition as disabled or inactive record
//Need to attachEvent, because IFRAME elements load asynchronously, and elements like 'newNoteButton' are not accessible on form load
var iframe = document.getElementById("notescontrol");
//Hide 'Create a New Note' link
var NotesTable = window.frames[0].document.getElementById('NotesTable');
//Disable the entire table
NotesTable.disabled = true;
var TextArea = NotesTable.getElementsByTagName('TEXTAREA');
//It's still necessary to individually disable the Textareas where users edit the existing notes.
for (i=0;i {
TextArea[i].disabled = true;

hope this helps.

No comments:

Post a Comment