I need to make a HTML web-resource where I can add a button on it. The button should open a Dialog, I have already made the HTML page and add it to the web-resources in CRM11. But now I need to pass parameters on the click event so we can call the dialog. The dialog gets triggered by the java script code in it. I don't know how to pass these parameters from HTML to javascript.
I need to add these parameters to the javascript code:
HTML
<HTML><HEAD><TITLE>Untitled Page</TITLE>
<META charset=utf-8></HEAD>
<BODY contentEditable=true>
<SCRIPT src="ClientGlobalContext.js.aspx"></SCRIPT>
<SCRIPT type=text/javascript src="rd_/javascripts/LaunchModalDialog.js"></SCRIPT>
<STYLE type=text/css>
#Button1
{
width: 200px;
}
</STYLE>
<P><INPUT id=Button1 onclick=LaunchModalDialog() value=button type=button> </P></BODY> </HTML>
Javascript
function LaunchModalDialog(dialogId, typeName, recordId)
{
var serverUrl = Xrm.Page.context.getServerUrl();
recordId = recordId.replace("{", "");
recordId = recordId.replace("}", "");
dialogId = dialogId.replace("{", "");
dialogId = dialogId.replace("}", "");
// Load Modal
var serverUri = serverUrl + '/cs/dialog/rundialog.aspx';
var myPath = serverUri + '?DialogId=%7b' + dialogId.toUpperCase() +'%7d&EntityName=' + typeName+'&ObjectId=%7b' +recordId+'%7d';
// First item from selected record
window.showModalDialog(myPath);
// Reload form
window.location.reload(true);
}