Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

hide/show subgrid that contains another entity, based on a value?

Posted on by 105

Hi,

So here's the situation:

Account entity has an option set (ex. Optionset) with a 3 different values.

The Account form has a related entity, History, in a subgrid (ex. subgrid_history).

I want to keep the subgrid hidden by default and show only when Optionset equals to value "Customer".

Q1: How can this be achieved?

Q2: Can this be achieved using a workflow too?

Thanks!

SB

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: hide/show subgrid that contains another entity, based on a value?

    if above suggested answer works then two thumbs it may work in 2016 crm online...... i suggest is to use subgrids in sections

    use js onload and onchange of optionset

    var tab = Xrm.Page.ui.tabs.get("general").sections.get("articles_section").setVisible(true);

  • Suggested answer
    Mahadeo Matre Profile Picture
    Mahadeo Matre 17,021 on at
    RE: hide/show subgrid that contains another entity, based on a value?

    Hi,

    You can use Javascript to show or hide subgrid based on option set value.

    suppose Optionset name is CustomerType and value for Customer in option set is 1

    then you can use javascript like

    var customertype = Xrm.Page.getAttribute('CustomerType ').getValue();

    if(customertype ==1)

    {

      Xrm.Page.getControl('subgrid_history').setVisible(true);

    }

    else

    Xrm.Page.getControl('subgrid_history').setVisible(false);

    call this script on form load and optionset OnChange event.

    For Q2: you cannot do this using workflow.

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans