To obtain a field from the header section of any form using JavaScript, the key is to append "header_" before the actual field name. For instance, if you want to retrieve the 'status' field (with the schema name 'statuscode') and the 'name' field from the case form, which are located in the header section, you should use "header_statuscode" and "header_name" respectively.
The following examples illustrate how to achieve this:
Javascript cdoe samples-
// Retrieving fields from the header section on the form
function getHeaderField(executionContext) {
var formContext = executionContext.getFormContext();
var status = formContext.getAttribute("header_statuscode").getValue();
// Other example - hiding the 'header_fieldname' control
Xrm.Page.getControl("header_fieldname").setVisible(false);
}
// Retrieving fields from form sections or tabs
function getField(executionContext) {
var formContext = executionContext.getFormContext();
var status = formContext.getAttribute("statuscode").getValue();
// Other example - hiding the 'fieldname' control
Xrm.Page.getControl("fieldname").setVisible(false);
}
No comments:
Post a Comment