locked
MSCRM- Onclick of new ribbon, Open specified form amoung two forms in an entity RRS feed

  • Question

  • Team

    I have an entity called Case(incident), in have created two forms- form 1 and form 2

    wen i click NEW Ribbon it should open Form 1.

    But now it s opening last viewed form of entity.

    Can anyone suggest how to change lastviewedformxml of UserEntityUISettings Entity using ODATA javascript, so tat wen ever i click on new ribbon it should open form 1.

    Thanks & regards

    Monday, July 6, 2015 12:13 PM

All replies

  • Hi Shree,

    Have you tried with

    Xrm.Utility.openEntityForm(name,id,parameters,windowOptions).

    Also refer below link to openEntityForm.

    https://msdn.microsoft.com/en-us/library/jj602956.aspx

    Thanks 

    Monday, July 6, 2015 12:56 PM
  • Suresh's comments are valid and I would certainly suggest taking a look at those.  However, I believe that what you want is a little different than what Suresh is suggesting.  

    In JavaScript I do something similar to what I think you want to do.  You can use the following code to change to another form.  In my form_load event for each form I have logic that deteremines which form the user needs to be on, then redirects them if need be.  For what I am doing, I have a lot of logic setup to control which form based on a user's roles, the current state of the record, etc. 

    You'll have to figure out the index of each of the forms (probably 0 or 1) by trail and error.  I don't know of a valid way to resolve the index.  I believe it is just a 0-based array based on how you have the ordered.  So if you change the order, be aware that this code might need to be adjusted. But it should be easy to test and adjust it as needed. 

    Xrm.Page.ui.formSelector.items.get(formIndex).navigate();
    


    Jon Gregory Rothlander

    Monday, July 6, 2015 4:20 PM