Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Creating Different Views Depending on "Relationship Type"

(0) ShareShare
ReportReport
Posted on by 365

Hi all,

Let me explain what I am trying to do: I am using the "Contacts" entity, and I have the field "Relationship Type" to show what type of contact a person is. Some types of contacts need all the fields and subgrids shown, whereas other types only need some. 

So far I have tried creating different views and forms, but I was only able to choose fields (not subgrids) to be shown by using views, and forms can obviously show both fields and subgrids, but I found out that I can't determine the form type by using my "Relationship Type" field (can only use security roles).

So is there something I am missing about views or forms, or is there other functionality that does what I described above? 

Any help appreciated! :)

*This post is locked for comments

  • RNSpeedy Profile Picture
    RNSpeedy 365 on at
    RE: Creating Different Views Depending on "Relationship Type"

    Thanks guys, realized that I could just set a tab to be default open or closed, making things much simpler and "update-proof" for my needs. Thanks again :)

  • Suggested answer
    ScottDurow Profile Picture
    ScottDurow 50,177 on at
    RE: Creating Different Views Depending on "Relationship Type"

    It really depends on the differences between the different types of relationships as to whether you need a different form or you can simple hide/show sections/fields. If there so many differences you may be better having a different form and using the technique described here - ms-dynamics-crm2011.blogspot.co.uk/.../how-to-change-form-type-dynamically.html

    Personally though I try to avoid dynamically changing the form and use the hide/show method.

    Hope this helps,

    Scott

  • Verified answer
    nikoleta Profile Picture
    nikoleta 455 on at
    RE: Creating Different Views Depending on "Relationship Type"

    For CRM 2013 forms scripting the SDK is here: msdn.microsoft.com/.../jj602964.aspx

    You can access the tab containing the section: var tab = Xrm.Page.ui.tabs.get('TABNAME');

    and then you can find the section: var section = tab.sections.get('SECTIONNAME');

    then you can use section.setVisible(true/false) to set the visibility

    If for example on the Account form you need to show various sub-grids of contacts then you would need to know what relationship types you have on related contacts to that particular account record before you set the sub-grids visibility.

    That can be done via a REST call and you can find samples if you download the SDK for your CRM version and look at ...SDK\SampleCode\JS\RESTEndpoint

  • RNSpeedy Profile Picture
    RNSpeedy 365 on at
    RE: Creating Different Views Depending on "Relationship Type"

    Thanks for the reply. I was hoping it wouldn't involve javascript, but it seems like that is the most likely solution right now. Do you know any good resources for learning how to do this?

  • nikoleta Profile Picture
    nikoleta 455 on at
    RE: Creating Different Views Depending on "Relationship Type"

    This may depend on how many Relationship Types you have and how dynamic those values are.

    If the number is fairly small and the values are static, then you can create views on the Contact for each type. Then on the forms where you want to show the sub-grids you can add a sub-grid for each view in different sections and then using a javascript you can hide/show all sections except for the relevant ones.

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

Featured topics

Product updates

Dynamics 365 release plans