Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

Hide/Show field based on entity view

Posted on by

Hello,

Have two fields named isProduct(Yes/No) and Product Detail, both of them are located in Contact Form.

I create two Contact Views: Active Contact with Product and Active Contact without Product, filter is isProduct=Yes or isProduct=No respectively.

Opening the record in Active Contact without Product, I hope the Product Detail Field is hidden.


Are there any ways to achieve it? Using JavaScript or have to implement Plugin? Could you give me some sample code? Thanks.

  • Suggested answer
    CRMJetty Profile Picture
    CRMJetty 3,508 on at
    RE: Hide/Show field based on entity view

    Hello ALL365,

    = > Yes we can do so.
    = > With the help of business rule we can hide particular fields based on view's filter.
    = > Refer this blog to hide/show fields based on some condition.

  • Suggested answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    RE: Hide/Show field based on entity view

    Hi Partner,

    You must add the "Product Detail" column on the forms firstly, then you can use business rule or js to hide/show it automatically.

    --Creating business rule

    pastedimage1680745271836v1.png

    Make the business rule scope is Entity, it can work on all forms,

  • ALAN365 Profile Picture
    ALAN365 on at
    RE: Hide/Show field based on entity view

    Hi Leah,

    Thank you so much for your detail explanation. Actually, is it possible, when I open the record listed in the "Active Contact without Product" View, the "Product Detail" column is hided automatically or doesn't install in the form? If yes, is this means different view open different record form?

    Thanks again.

  • Suggested answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    RE: Hide/Show field based on entity view

    Hi Partner,

    Hiding 'Product Detail' field on the View? or on the Form?

    2.You mentioned that you have created two contact views, so there is no need to hide the fields in the view, you just don't add the 'Product details' field to the 'Active contacts with products' view.

    1)Active Contact with Product

    pastedimage1680586833052v5.png

    pastedimage1680586853459v6.png

    2)Active Contact without Product

    pastedimage1680586906350v8.png

    pastedimage1680586878163v7.png

    2.If you don't want to see 'Product details' on the form when the 'isProduct' field equals 'No', you can use buisness rule to hide it easily.

    pastedimage1680586542985v4.png

    --Creating one business rule:

    pastedimage1680586442300v3.png

    --Test:

    pastedimage1680586360723v1.pngpastedimage1680586378973v2.png

    If you want to hide fields through javascript, you can refer to the following link:

    https://shafiuddinmicrosoftdynamics365crm.wordpress.com/2020/05/02/using-javascript-hide-and-show-a-field-in-microsoft-dynamics-365-crm/ 

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,645 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans