How to Redirect to a Readonly Entity Form in CRM 2011
Sometimes, if you want to have a readonly form in CRM 2011, this article is what you want. We can call the following URL for readonly form in CRM 2011.
http://SERVER Name/ORG NAME/_forms/print/custformprint.aspx?
Query String Parameters
Parameter | Value | Comment |
allsubgridspages | Optional true or false. Default is false. |
If CRM form has a Sub-Grid in it, this parameter decides whether to show Paging for the SubGrids. If set to true, it will show all the records of Sub-Grid, without any Pagination. |
id | Mandatory | GUID. Guid of CRM entity record |
formid | GUID. Optional |
Form Id, if not given it and if there are multiple forms available for given entity it will follow CRM’s way of showing appropriate form. |
objectType | Mandatory | Number. Object Type Code for Entity |
Here is the sample Java script for that.
changeToReadOnlyPage = function()Here is the sample JavaScript function.
{
var CRM_FORM_TYPE_CREATE = 1;
var CRM_FORM_TYPE_READONLY = 3;
if( Xrm.Page.ui.getFormType()== CRM_FORM_TYPE_CREATE)
window.location =Xrm.Page.context.getServerUrl() + “/” + Xrm.Page.context.getOrgUniqueName() +
“/_forms/print/custformprint.aspx?objectType=” + Xrm.Page.context.getQueryStringParameters().etc;
else if( Xrm.Page.ui.getFormType() != CRM_FORM_TYPE_READONLY)
window.location = Xrm.Page.context.getServerUrl() + “/” + Xrm.Page.context.getOrgUniqueName() +
“/_forms/print/custformprint.aspx?id=” + Xrm.Page.data.entity.getId()+ “&objectType=” + Xrm.Page.context.getQueryStringParameters
().etc;
}