Often we have requirement to read option set Text/Value quickly, I wrote a script to quickly read all option sets on a form
Go to Google chrome console(Press F12 in Chrome), select the option Console as per screen, Note that contentIframe0 is selected :
and run following script on your form :
var attributes = Xrm.Page.data.entity.attributes.get();
var optionSetAttributes = ”;
var optionSetValues = ”;
Xrm.Page.ui.controls.forEach(function (control, index) {
if (control.getControlType() == ‘optionset’) {
optionSetValues = ”;
var controlName = “#” + control.getName() + “_i”;
optionSetValues += control.getName() + ” option set values below: \n\n”;
$(controlName).find(‘option’).first().nextAll().each
(function () {
optionSetValues += ‘<div>’ + ‘Value: ‘ + $(this).attr(‘value’) + ‘,Title: ‘ + $(this).attr(‘title’) + ‘</div>’;
}
);
}
optionSetAttributes += ‘<div>’ + optionSetValues + ‘</div>’;
});
var htmlString = ‘<div style= “overflow:always”>’ + optionSetAttributes + ‘</div>’;
$(“#processControlCollapsibleArea”).after(htmlString);
var w = window.open(“Surprise”, “#”);
var d = w.document.open();
d.write(htmlString);
d.close();
You will get following new page:
Just do Ctrl+ C and you are done!
Hope it helps!
[…] Bookmarklet: Get Optionsets on Form inspiriert von Deepesh Somani Öffnet eine neues Fenster mit einer Liste aller Optionsets und deren Werte auf dem […]
[…] Optionsets on Form inspiriert von Deepesh Somani Öffnet eine neues Fenster mit einer Liste aller Optionsets und deren Werte auf dem […]
Reblogged this on Nishant Rana's Weblog.