locked
Multiple main entity forms shipped with different soltuions ... RRS feed

  • Question

  • Hi,

    We have a default 'user' form customized and in our solution A. When we install the solution A to an instance where Solution B already has created a 'new' user form and set as top in order, users are not able to see our solution A form, the default form in which we have solution A customizations.

    Yes, I can

    • change the order back for the default 'user' form; or
    • control the display of forms using security roles

    1. But what if users want to work with the customizations from both the user forms. Is there any way to provide this from development side so that user can have a choice to select which form they work in at any give time?

    2. I read at https://technet.microsoft.com/en-us/library/dn531143.aspx#BKMK_ControlAccessToForms:

    When you have more than one main form, you can specify a form order that will control which of the forms a person is allowed to see will be the one they see by default. If there is more than one form they can use, they can change forms and the form they choose will be their default form until they choose a different one. This preference is stored in their browser. If they use a different computer or browser they will see the original default form.

    If this is the only way for the user to work on either form as required?



    blog: <a href="http://technologynotesforyou.wordpress.com">http://technologynotesforyou.wordpress.com</a> | skype: ali.net.pk








    • Edited by Khadim Ali Wednesday, July 1, 2015 10:40 AM
    Wednesday, July 1, 2015 9:43 AM

Answers

  • I might have missed your point in my last response.  If you are in CRM and need to change to another form, note that the title of the form in the left-hand navigation is a drop-down list once you add multiple forms.  You can select it and change to the other form as needed, so long as you do not have permissions setup to block them.

    Jon


    Jon Gregory Rothlander

    • Marked as answer by Khadim Ali Thursday, July 2, 2015 8:38 AM
    Wednesday, July 1, 2015 8:45 PM

All replies

  • Not sure if this will help you, as I am struggling a bit to understand what you are trying to do.  But you might want to take a look at doing something like the following.  This will allow you to use JavaScript to control which form is displayed.  If you can determine the logic of when to show which form, this might work for you.

    What is going on here is that each form has a GUID. You can use that GUID in JavaScript to open a given form. There's a few ways to get the GUID, but I just go into the CRM database and pull it from the SystemForm view and  the FormId column.  I rename the view, then search the Name column for my new name.  There's other ways to get it, but this is the easiest for me. 

    So for me, I have an entity called dhi_hbc and I have four different forms. Two of those are controlled via the users role and security settings on the form, like you described where I have one that is read-only another one that only has a few fields, but the other two are displayed based on a field value on the entity. 

    What I am doing is that I have a wizard setup in JavaScript that when they first create a record it steps them through the wizard to get the initial record created.  But once they finish all the steps of the wizard, I no longer use that form. So as they work through each step of the wizard, I set a field value to tell me which steps they have completed, as they might stop and close the form and come back later.  The last step in the wizard sets a final value that tells the form that the wizard has been completed and opens the second form without the wizard.  Now if the user closes the form without completing the wizard, the code knows where they stopped and where to start them back at.  But if they have finished the wizard, the code redirects them to the other form.

    Now there are a couple of issues, as redirecting will cause the form to show, then reload. There's also an issue where which ever form was last load, CRM caches and loads that one first.  So you have to code the logic in each form to redirect as needed... all 4 of them in my case.  There's a workaround where you can modify the cached form name at runtime and stop this from happening.  Take a look at: http://gonzaloruizcrm.blogspot.com/2014/11/avoiding-form-reload-when-switching-crm.html

    Here's the code I used to open the form as a separate popup form via JavaScript.

            var parameters = {};        
            var shrtFormGuid = "c4c7afe1-1678-43fc-9062-d58752686876";
            parameters["formid"] = shrtFormGuid;
            parameters["parameter_0"] = loanId;
            Xrm.Utility.openEntityForm("dhi_hbc", null, parameters);
            Xrm.Page.ui.close();

    I also just change from one form for the entity to another using an index. This works if you already have the form open and just need to change to another form for the same entity.  It sounds like this is more along the line of what you need.  I don't know how to determine the index, but I think it is just 0-based according to the order.  Trial and error should let you id which id belongs to which form.  But keep in mind that if it is based on the order, if you change your order around, it will effect this code.  I think I ran into that and had to reset my index in JavaScript once I had a final order setup for the forms.

     var longFormId = 1,
     Xrm.Page.ui.formSelector.items.get(longFormId).navigate();

    If you play around a bit with code like this, you might be able to resolve your issue and get it to work the way you need it to.

    Best regards,

    Jon


    Jon Gregory Rothlander


    Wednesday, July 1, 2015 8:40 PM
  • I might have missed your point in my last response.  If you are in CRM and need to change to another form, note that the title of the form in the left-hand navigation is a drop-down list once you add multiple forms.  You can select it and change to the other form as needed, so long as you do not have permissions setup to block them.

    Jon


    Jon Gregory Rothlander

    • Marked as answer by Khadim Ali Thursday, July 2, 2015 8:38 AM
    Wednesday, July 1, 2015 8:45 PM