Sunday, July 24

How to hide field(s) on MS CRM form


To hide field (e.g. owner_name) on an MS CRM form, 


- Go to customisation, open entity, open main form.
- Open form properties
- On Events Tab, edit OnLoad list item
- tick mark 'Event is enabled'
- Write following code in the box below


/* Hide a form field */
crmForm.all.ownerid_c.style.visibility = 'hidden';
crmForm.all.ownerid_d.style.visibility = 'hidden';

OR 


/* Hide a form field */
crmForm.all.ownerid.style.display ="none";


Here, _c is used to hide the label and _d is used to hide the field.


And, If you want to hide no. of fields which you want to hide, make one Section in to the form and put all that fields in to it.


Write following Code in to Form's onload event javascript.


crmForm.all.tqh_name.parentElement.parentElement.parentElement.style.display = 'none';


Where tqh_name is the name of one of the fields which you want to hide. 
.parentElement.parentElement.parentElement will target field's section and then 'none' style will be applied. 



No comments:

Post a Comment

Note: only a member of this blog may post a comment.