Show/Hide Tab , Section and fields in Dynamics CRM
In this code, formContext
represents the context of the current form. You should have access to it within the appropriate event handler or function where you want to show or hide the tab.
Again, make sure to replace "your_tab_name"
with the actual name of the tab you want to show or hide.
In this code, you first specify the name of the section you want to show or hide by setting the sectionName
variable. Then, you use the formContext.ui.tabs.get(tabName).sections.get(sectionName)
method to retrieve the section object based on its name. If the section object is found (section != null
), you can call the setVisible()
method on the section object to either show or hide the section by passing true
or false
as the parameter.
Make sure to replace "your_section_name"
with the actual name of the section you want to show or hide.
In this code, you specify the name of the field you want to make read-only or editable by setting the fieldName
variable. Then, you use the formContext.getAttribute(fieldName)
method to retrieve the field object based on its name. If the field object is found (field != null
), you can call the setDisabled()
method on each control associated with the field to make it read-only or editable.
By default, a field can have multiple controls associated with it (e.g., a text box, a lookup field). The field.controls
property returns an array of all the controls associated with the field, and you can iterate over them using a forEach
loop.
To make the field read-only, you call control.setDisabled(true)
. To make the field editable, you can call control.setDisabled(false)
.
Remember to replace "your_field_name"
with the actual logical name of the field you want to modify.
Comments
Post a Comment