web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Best Practice for opening multiple forms in a single entity

(0) ShareShare
ReportReport
Posted on by

Hi everyone, 

I have 3 main forms in the account entity. Form1, Form2, and Form3

I would like to know the best approach to open the form upon asking for user input. I would like there to be some way to ask the user which form to open then open the corresponding form.

Note: All users can access all forms so I do not want to use the security roles approach.

Thanks 

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Use Ribbon Workbench and add 'Edit' buttons in the Command bar. This will help you redirect the user from the View to a required Form. Use FormId to redirect to the required Form. Refer this:

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    You can add an option set field with tge name of tge forms. And then write a javascript onload and onchange to open the form based on that value.

    Hope this helps

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Shubh,

    you could follow three approaches:

    1) three custom buttons on entity Home Page, like "Open with Form 1", "Open with Form 2", "Open with Form 3" (need Ribbon Workbench + javascript)

    2) one "passing form" set as main form, where you could "automate" form opening: if user never choose a form, let him choose it (popup o picklist o webresource, etc.); once choosed a form you could "save" it into a new user attribute (we say "Default Form") an opening always this form on next "passing form" check (javascript only)

    3) add "other form" button inside the default form which can rapidly change form clicking on it (webresource + javascript)

    Please let me know if you solve.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • Community Member Profile Picture
    on at

    Hi Francesco,

    How can I perform the 2nd approach. Only thing though, I don't want to automate form opening. I would like to have user input each time the user wants to create a record. Do you have javascript for the popup o picklist o webresource approach?

    Thanks

    Shubh

  • Suggested answer
    imayur Profile Picture
    630 on at

    Hi,

    Can you please elaborate user input?

    I think this is out of the box functionality to switch form. Above name of record there is dropdown contains forms are listed. By selecting form from the dropdown, the selected form will be switched for the  saved or new record.

    There are multiple ways to select form by code as well.

    1. On change of optionset/field.
    2. Add buttons on ribbon and write code to switch form.
    3.  Based on some value of field form can be switched.

    You can refer below for switching form

    function SwitchForm() {
        var lblForm;
        var val = Xrm.Page.getAttribute("new_somefield").getValue();
        switch (val) {
            case 'Form1':
            case 'Form2':
                lblForm = "TEST Form1";
                break;
            default:
                lblForm = "Information";
        }
        var formLabel = Xrm.Page.ui.formSelector.getCurrentItem().getLabel();
    
        if (Xrm.Page.ui.formSelector.getCurrentItem().getLabel() != lblForm) {
            var items = Xrm.Page.ui.formSelector.items.get();
            for (var i in items) {
                var item = items[i];
                var itemId = item.getId();
                var itemLabel = item.getLabel()
                if (itemLabel == lblForm) {
    
                    if (itemLabel != formLabel) {
                        item.navigate();
                    }
                }
            }
        }
    
    }
    
    


  • Community Member Profile Picture
    on at

    I actually want the user to be able to select the form when clicking "new" button on some entity. I am aware that the user can simply switch form the drop down menu but to make it simpler for the user, I would like to system to ask for user input to avoid human error.

  • Suggested answer
    imayur Profile Picture
    630 on at

    Here is one approach

    • A custom ribbon button for New and web resource contains dropdown list to select form and button to open form new form.
    • Open the web resource in XRM Internal dialog.

    You can refer below snippet to generate url for opening particular form

    var newFormurl = crmOrgeUrl + '/main.aspx?etn=[entityname]&extraqs=etc=[entitytypecode]&formid=[formguid]&id={[recordguid]}&pagetype=entityrecord';

    [formguid] is where you have pass form guid and some parameters are not needed

    window.open(newFormurl); //to open form

  • Community Member Profile Picture
    on at

    Hi,

    Do you have the code for the web resource dropdown list?

    Thanks

  • Community Member Profile Picture
    on at

    Hi Shubh G,

    if you identify the solution thanks to an answer, please mark it as verified to encourage the community to provide more and more a better support.

    Then open a more focused question about creating a web resource (or other solution) to popup a request to user to change form: it will be hepful to other people searching for a such solution.

    Thank you. Francesco

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans