Below is the script which provides the name of the MSCRM form tab & the section with the provided name of the field in which the placed on the form.
function getTabNameWithField(fieldName) {
var tabName = null;
var fieldElement = parent.$("#" + fieldName);
if (fieldElement != null && fieldElement.length > 0) {
var tabElement = fieldElement.closest(".ms-crm-InlineTab-Read");
if (tabElement != null && tabElement.length > 0) {
tabName = tabElement.attr("name");
}
}
return tabName;
}
function getSectionNameWithField(fieldName) {
var sectionName = null;
var fieldElement = parent.$("#" + fieldName);
if (fieldElement != null && fieldElement.length > 0) {
var sectionElement = fieldElement.closest(".ms-crm-FormSection");
if (sectionElement != null && sectionElement.length > 0) {
sectionName = sectionElement.attr("name");
}
}
return sectionName;
}
Call the function as below:
getTabNameWithField("name");
getSectionNameWithField("name");
No comments:
Post a Comment