I am using below cde but its not working pls some one help me.
function getFieldListFromTab(tabId) { var fieldList = new Array(); var tab = Xrm.Page.ui.tabs.get(tabId); tab.sections.forEach(function (section, sectionIndex) { section.controls.forEach(function (control, controlIndex) { var attribute = control.getAttribute(); if (attribute != null) { fieldList.push(attribute.getName()); } }); }); return fieldList; }
*This post is locked for comments
Hi Naresh,
You can also refer the following link to retrieve all controls:
www.mscrmconsultant.com/.../retrieve-form-all-controls-using.html
Regards,
Rajkumar Rajaraman
Hi,
Try the following code:
function getFieldListFromTab(tabId) { var fieldList = new Array(); var tab = Xrm.Page.ui.tabs.get(tabId); tab.sections.forEach(function (section, sectionIndex) { section.controls.forEach(function (control, controlIndex) { switch (control.getControlType()) { case "standard": case "lookup": case "optionset": var attribute = control.getAttribute(); if (attribute != null) { fieldList.push(attribute.getName()); } break; } }); }); return fieldList; }
See: http://www.xrmcoaches.com/2012/04/retrieve-all-of-the-field-names-in-a-tab/
You need to put a check for control types subgrid in section. Use below code:
function getFieldListFromTab(tabId) { var fieldList = new Array(); var tab = Xrm.Page.ui.tabs.get(tabId); tab.sections.forEach(function (section, sectionIndex) { section.controls.forEach(function (control, controlIndex) { if(control.getControlType() != "subgrid" && control.getControlType() != "iframe" && control.getControlType() != "webresource" && control.getControlType() != "notes" ) { var attribute = control.getAttribute(); if (attribute != null) { fieldList.push(attribute.getName()); } } }); }); return fieldList; }
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156