Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to hide/disable form selection within a "New" or "Edit" record?

(0) ShareShare
ReportReport
Posted on by 95

I have two main forms using the same entity. How do can I disable or hide the ability for the user to select which form from within a "New" record or "Edit" record screen?

I would like to disable or hide the highlighted Form change dropdown. The users need to have both but I will direct them there from the navigation pane.

pastedimage1618858240450v1.png

P.S. Is there a way to also rename the form header instead of use the Entity name?

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to hide/disable form selection within a "New" or "Edit" record?

    Hi mykedeabreu,

    You want to load one form when user create new records and load another form when edit original records, right?

    If so, you can use js code (formContext.ui.formSelector property) to load different forms automatically.

    formContext.ui.FormSelector (Client API reference) in model-driven apps - Power Apps | Microsoft Docs

    Take the account entity as an example, it lists two forms for select.

     pastedimage1619070076841v1.png

    Here are steps:

    1.Write js code.

    For new records and original records, their name field is different, you can use it as condition.

     

    function NavigateForm(executionContext) {
        var formContext = executionContext.getFormContext();
        var name = formContext.getAttribute("name").getValue();
    
        var currentItem = formContext.ui.formSelector.getCurrentItem();//current form
    
        var availableForms = formContext.ui.formSelector.items.get();//list all forms 
        var formItem1 = availableForms[0];//Account form
        var formItem2 = availableForms[1];//New form
    
        if (name != null) {
            if (currentItem != formItem1)//curren form is not Account
                formItem1.navigate();//redirect to Account form
        }
        else {
            if (currentItem != formItem2)//curren form is not New form
                formItem2.navigate();//redirect to New form
        }
    }

    2.Add js to the form.

    (1)Go Settings > Customizations > Customize the system > Web Resource.

    pastedimage1619070265131v2.png

    (2)Go Settings > Customizations > Customize the system > Entities > Account > Forms to open 'Account' form.

    Clicking 'Form properties' to add the web resource.

    pastedimage1619070525167v3.png

    (3)Repeat step(2) in 'New Form'.

    (4) Save and publish all customizations.

    3.Test,

    pastedimage1619072276016v4.pngpastedimage1619072300702v5.png 

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • mykedeabreu Profile Picture
    mykedeabreu 95 on at
    RE: How to hide/disable form selection within a "New" or "Edit" record?

    Thank you for your response. I do need both forms available to the user. If they have a New Request: they need to see "New Request" form. If they have "Change Request" they need a form where they are selecting a client then changing some fields.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to hide/disable form selection within a "New" or "Edit" record?

    Hi partner,

    What you need is that show only one main form when create or edit form, right?

    If so, you can set it in app designer(For example, I'll use the account entity to test).

    1.Check which app you are using, then find it to click … button to open in app desiner.

    pastedimage1618887309891v1.png

    Find the entity you need and click 'Forms', you will notice that all forms are checked in the right pane.

    pastedimage1618887538459v3.png

    Then you can uncheck 'All' and select one main forms you want to check, save and publish it.

    pastedimage1618887666570v4.png

    Test:

    Before:

    pastedimage1618887473514v2.png

    After:

    pastedimage1618887961069v5.png

    For second question, "rename the form header instead of use the Entity name".

    Unfortunately, you can't change it with value you want, which is by-design.

    It shows 'New + Entity name' for new records, and shows 'name' for existing records.

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans