4

We have two forms for the case entity. The default case form is heavily customized and has become rather slow to work with. The second form, called 'fastcase', is a lightweight version of the default case form. Both forms are being used by the same users. The fastcase form is opened from a link in SharePoint. We want that the default case form is always opened when working from within CRM.

I was wondering if, and how, it is possible to force CRM to always open the default case form when working from within CRM.

The only thing I could find was this link, but I have a feeling that the solution with navigate will also force the SharePoint fastcase form to open in the default case form. Working with different user roles and groups is also not an option as suggested there.

2 Answers 2

4

First of all: You are not using forms they are supposed to be used. Forms are role based and you are trying to use them for something else. Anyway, I totally understand your idea and I have been in the same situation :)

You need to do a little magic trick in CRM to make a form sticky. CRM stores the Most Recently Used (MRU) forms in a special entity called UserEntityUISettings. This entity stores UI settings per entity per user in xml.

What you need to do is to prevent CRM from changing this entity whenever the user changes the form for a given entity. Basically you want to control the attribute called lastviewedformxml. You can get some inspiration from this blog post: https://community.dynamics.com/crm/b/gonzaloruiz/archive/2014/11/19/avoiding-form-reload-when-switching-crm-forms-based-on-a-field.aspx

Happy coding...

3
  • Thank you for your insights. This solution is indeed the way we would want to do this. However, since it is not really supported I believe it is best to just leave it at that.
    – Dafalgor
    May 26, 2015 at 11:09
  • I wouldn't say it's unsupported... but it is a grey area at the very least. Thanks for the answer!
    – Nathan
    Nov 29, 2017 at 8:04
  • @Dafalgor It doesn't seem unsupported. You're not hacking anything, as far as I can tell, like direct CRM DB manipulations or direct JQuery-based form manipulation...
    – MBender
    Sep 13, 2018 at 10:59
1

You can open CRM forms in this way:

function OpenForm() 
{
    var parameters = {};
    var id = GetFormId("account", "FormName");
    parameters["formid"] = id;
    Xrm.Utility.openEntityForm("account", null, parameters);
}

function GetFormId(formEntity, formName) {
    var serverUrl = Xrm.Page.context.getServerUrl();
    var oDataEndpointUrl = serverUrl + "/XRMServices/2011/OrganizationData.svc/";
    oDataEndpointUrl += "SystemFormSet?$top=1&$filter=ObjectTypeCode eq '" + formEntity + "' and Name eq '" + formName + "'";
    var service = new window.XMLHttpRequest;
    var id;
    if (service != null) {
        service.open("GET", oDataEndpointUrl, false);
        service.setRequestHeader("X-Requested-Width", "XMLHttpRequest");
        service.setRequestHeader("Accept", "application/json, text/javascript, */*");
        service.send(null);
        var requestResults = eval('(' + service.responseText + ')').d;
        if (requestResults != null && requestResults.results.length == 1) {
            var rec = requestResults.results[0];
            id = rec.FormId;
        }
    }
    return id;
}

Depends the way you are calling the form from sharepoint you call the form you need and from CRM you let it handles in the native way.

1
  • In a project a few years ago, we used Javascript to tightly control form access. Our architect didn't understand why Normalization was such a good thing for CRM...so we wound up with a user flow where someone went through about three forms per Entity =/ But yes, we did something like what's proposed here. Apr 10, 2015 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.