locked
Associated Views and Deep Queries RRS feed

  • Question

  • Hi.

    I'm organizing forms, views and fields in MS CRM 2011 (UR5, Windows Server 2008 R2) for a Marina Company. And have a question about it.

    There is an associated view called "Campaign Associated View(Marketing)" for a Contact which you can see the campaigns that is sent before to current Contact. But this associated view is located at left navBar. Only way I see is to add this associated view from Relationship Explorer to navBar. Can't add anywhere except navBar.

    What I need is to disable whole navBar and display this Campaign Associated View into a subGrid located at the main Contact form.

    I wonder if I can do this.

    As I couldn't manage to do this, I decided to use deep query approach with joining these entities (CampaignActivity->MarketingList->Contact) but now I can't handle syntax errors in fetch.xml in JS. I also tried to change customization.xml but importing the solution was also unsuccessful.

    I think I need a safe document (even for fetch.xml syntax) or I'd like to know If I can do the first thing without fetch.xml.

    Thanks for your time.

    Can

    Friday, July 12, 2013 6:57 AM

Answers

  • Oh I see your problem now. You might be able to do this using a sub-grid of campaign activities filtered with JavaScript to show only for the current contact.

    When you add the sub-grid you'll need to specify 'All Record Types' instead of 'Only Related' so that you can select Campaign Activity (as there is no direct relationship from contact).

    Build your fetch xml query in advanced find first, using a placeholder contact. This should allow you to see all the campaign activities for a particular contact. Then you just need to dynamically insert the ID of the contact into the fetch xml so that it always shows campaign activities for the contact you are viewing.

    Finally, following this blog post (which I coincidentally wrote) you can filter the results in the subgrid:
    http://www.magnetismsolutions.com/blog/paul-nieuwelaars-blog/2013/01/24/filter-sub-grid-dynamics-crm-2011-rollup-12-(polaris)

    The code in this blog post is for rollup 12 and later, however there is a link in there for previous rollups as well if needed.

    Hope that helps

    Paul


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    • Marked as answer by cankabaklarli Tuesday, July 16, 2013 11:10 AM
    Friday, July 12, 2013 2:03 PM

All replies

  • Just to clarify your requirements, you want to add a sub-grid of campaigns to the contact form using the view specified, and you also want to disable the whole left-navigation from contacts?

    1. Sub-grid can easily be added to a form from the 'Insert' tab and selecting 'Sub-Grid', then using 'Only Related Records' select the campaign entity related to contact. Finally select the default view and click Ok.
    2. To completely disable the left-navigation, back on the 'Home' tab click on 'Form Properties'. In the form properties dialog, click the Display tab, and then uncheck the box 'Show navigation items' and click Ok.

    Hope that answers your question

    Paul


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Friday, July 12, 2013 12:12 PM
  • Hi Paul. Thanks for the reply.

    No problem left to disable the navBar. But other stuff is much more complicated I thought.

    Relations between entities;

    N:N - Contact to Marketing List

    N:N - Marketing List to Campaign Activity

    and no relation between Contact and Campaign Activity.

    --

    So, solution that you mentioned is getting whole Campaign Activities and displaying these at Contacts form. But I'm looking for this;

    Getting Campaign Activities which is sent to current contact. To do this; I first need to get a Campaign Activity, then check the Marketing List, find Contacts and validate if the current user is on the Marketing List, then display. That's why I was arguing with fetch.xml and customization.xml. 

    I'll be glad If you guide.

    Friday, July 12, 2013 1:03 PM
  • Oh I see your problem now. You might be able to do this using a sub-grid of campaign activities filtered with JavaScript to show only for the current contact.

    When you add the sub-grid you'll need to specify 'All Record Types' instead of 'Only Related' so that you can select Campaign Activity (as there is no direct relationship from contact).

    Build your fetch xml query in advanced find first, using a placeholder contact. This should allow you to see all the campaign activities for a particular contact. Then you just need to dynamically insert the ID of the contact into the fetch xml so that it always shows campaign activities for the contact you are viewing.

    Finally, following this blog post (which I coincidentally wrote) you can filter the results in the subgrid:
    http://www.magnetismsolutions.com/blog/paul-nieuwelaars-blog/2013/01/24/filter-sub-grid-dynamics-crm-2011-rollup-12-(polaris)

    The code in this blog post is for rollup 12 and later, however there is a link in there for previous rollups as well if needed.

    Hope that helps

    Paul


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    • Marked as answer by cankabaklarli Tuesday, July 16, 2013 11:10 AM
    Friday, July 12, 2013 2:03 PM
  • Hey Paul.

    OK, I did the same. Built the fetch.xml query in advanced find first then dynamically insert the ID of contact.

    Many thanks (even for the blog post)

    Tuesday, July 16, 2013 11:10 AM
  • Hey, Please can you send me the fetch xml query. I am new to Dynamics CRM Development. Thanks Vprasanth

    Tuesday, January 6, 2015 9:20 PM