Introduction
This article demonstrates how to pass the dynamic value as the parameter to the Web resource from any entity form. This article starts with an introduction of the Web Resource creation. Afterwards, it demonstrates how to map and add event handler for a control in the Entity Form.
Creating a Web Resource
JavaScript function ValidateBaseline given below accepts few parameters (context, isFrmSave), which are passed from an Entity Form, “OnChange” of BaseLine field (“Two Option Set”). The same ValidateBaseLine function is also called in Form OnSave event also. The value of the parameter isFrmSave is set as true in this case.
- function ValidateBaseLine(context, isFrmSave) {
- var saveEvent = context.getEventArgs();
- var result = false;
- var mtdname = Xrm.Page.getAttribute("new_measuretypedetailsname").getValue();
- if (mtdname.length > 0) {
- mtdname = mtdname[0].name
- };
- var mname = Xrm.Page.getAttribute("new_measurename").getValue();
- if (mname.length > 0) {
- mname = mname[0].name
- };
- var pmdname = Xrm.Page.getAttribute("new_name").getValue();
- var isbaseline = Xrm.Page.getAttribute("new_baseline").getValue();
- if (isbaseline) {
- If((pmdname.indexOf(mname) !== -1) || (pmdname.indexOf(mtdname) !== -1)) {
- result true;
- }
- }
- if (result) {
- if (isFrmSave) {
- saveEvent.preventDefault();
- } else {
- return false;
- }
- }
- return true;
- } // This is just a sample script. Paste your real code (javascript or HTML) here.
- if ('this_is' == /an_example/) {
- of_beautifier();
- } else {
- var a = b ? (c % d) : e[f];
- }






Join the conversation! Your thoughts help the community grow.