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)

Creating Different Views Depending on "Relationship Type"

(0) ShareShare
ReportReport
Posted on by 367

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

I have the same question (0)
  • nikoleta Profile Picture
    457 on at

    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.

  • RNSpeedy Profile Picture
    367 on at

    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?

  • Verified answer
    nikoleta Profile Picture
    457 on at

    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

  • Suggested answer
    ScottDurow Profile Picture
    21 on at

    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

  • RNSpeedy Profile Picture
    367 on at

    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 :)

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