var valueToSwitch = Xrm.Page.getAttribute("yourField").getValue();Catch error:
switch(valueToSwitch)
{
case 0:
//what to do if value = 0
break;
case 1:
//what to do if value = 1
break;
case 2:
//what to do if value = 2
break;
}
try {Force submit (fields that are marked read only - make scripts able to write to them)
//Code
}
catch (ex) {
var txt="You got the following error\n\n" + ex;
alert(txt);
}
Xrm.Page.getAttribute("youField").setSubmitMode("always");Forminfo check:
function forminfo()Maximize window
{
var items = Xrm.Page.ui.formSelector.items.get();
if (items.length > 1)
{
alert("Formtype: " + Xrm.Page.ui.getFormType());
alert("Form ID: " + Xrm.Page.ui.formSelector.getCurrentItem().getId());
alert("Formname: " + Xrm.Page.ui.formSelector.getCurrentItem().getLabel());
}
else
{
alert("There is only one form item currently available.");
}
}
window.top.moveTo(0,0);Get name of selected picklist value
window.top.resizeTo(screen.width, screen.height);
Xrm.Page.data.entity.attributes.get("crayon_fagomrde").getText();Start Dialog from Form (note tings to change)
var dialogId = "a13ad982-d812-40a0-ab67-f314cdabbd2b"; // This must be your Dialog IDSet URL to Iframe
var returnValue = showModalDialog("/" + Xrm.Page.context.getOrgUniqueName() + "/cs/dialog/rundialog.aspx?DialogId=%7b" + dialogId + "%7d&EntityName=account&ObjectId=" + Xrm.Page.data.entity.getId());
//Optional:To save and close entity form as soon as the dialog is closed.
//Xrm.Page.data.entity.save("saveandclose");
var url = http://www.crayon.comThis was some of the basic javascripts..
Xrm.Page.getControl("IFRAME_iFrameName").setSrc(url); //("about:blank") if black
Hope it's usefull for you!