When creating a Web Resource Page in MS CRM there are some basic parts that I've tend to use in all of my pages. These are all contained in the script block above the body.
User Information:
UserId = Xrm.Page.context.getUserId();
UserName = Xrm.Page.context.getUserName();
Query String parameters to drive the page
QueryStringParameters = Xrm.Page.context.getQueryStringParameters();
QueryStringParm = "None";
if (QueryStringParameters["feature"] != null) {
QueryStringParm = QueryStringParameters["feature"].toString();
}
Entity Id - when you are running in a Form iframe and the entity has been saved.
EntityId = window.parent.Xrm.Page.data.entity.getId();
Id = QueryStringParameters["id"].toString();
Trigger for Query
document.onreadystatechange = function () {
if (document.readyState == "complete") {
// Typically call a query to populate the page
}
}
Function to Open a CRM Form in a new window
function OpenCRMForm(entityName, entityId) {
var windowOptions = {
openInNewWindow: true
};
Xrm.Utility.openEntityForm(entityName, entityId, null, windowOptions);
}
Wednesday, October 4, 2017
Subscribe to:
Posts (Atom)