locked
CRM 2011 - RetrieveMultiple message on Contact Activities RRS feed

  • Question

  • Last week, I was trying to modify the QueryExpression on RetrieveMultiple for contact Connections as follows:

    When clicked on Connections from Contact left nav, I wanted to show not only the connections related to this contact but also connections related to opportunities and Incidents associated with this contact.

    Paul, helped me to get this done discussed on a separate thread named: "Modifying QueryExpression on RetrieveMultiple Message" and I got this to work and it works perfectly.

    Now we wanted to do the same thing on Contact related Activities (i.e. when clicked on Activities from Contact left nav, to include some other child entities associated activities) but somehow the RetrieveMultiple message does not get sent/triggered when this link is clicked (it does trigger though if you do it from the main page - clicking on Activities on the main page).

    By the way, currently we are using rollup message for this and it works but I was told rolllup message is not supported and I was trying to replace the rollup message with retrievemultiple.

    Any comments in this regard is greatly appreciated.

    P.S. Paul, I hope you get this and respond. Look forward to your response.

     

    Wednesday, August 7, 2013 11:53 PM

Answers

  • Hello again, I see everything, I never sleep! :)

    I've taken a look and can definitely reproduce your behaviour, it would seem that CRM does its own method of retrieving the activities that does not use a RetrieveMultiple request.

    The reason it will be like this is because it has to display the 'related regarding' records from other entities (like opportunities) - so my guess is they're getting all the activities somehow and then combining the lists. Problem is that it's not using a conventional RetrieveMultiple so it doesn't look like we can hook into it. I even tried firing a plugin on retrieve multiple of any entity to see if it was just retrieving them under a different entity name - but this does not seem to be the case.

    If you change the selection from 'Related Regarding Records' to 'This Record Only' it will then hit the plugin (as it's not getting records from other places now).

    For now I'm not seeing a way to hook into this message.

    An alternative approach might be to add a custom subgrid to your form or left-nav, and hide the default Activities nav-items. However this would mean having to recreate all the related regarding joins.

    I'll keep investigating as I share a common interest in this one.

    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


    Thursday, August 8, 2013 7:50 AM

All replies

  • Hello again, I see everything, I never sleep! :)

    I've taken a look and can definitely reproduce your behaviour, it would seem that CRM does its own method of retrieving the activities that does not use a RetrieveMultiple request.

    The reason it will be like this is because it has to display the 'related regarding' records from other entities (like opportunities) - so my guess is they're getting all the activities somehow and then combining the lists. Problem is that it's not using a conventional RetrieveMultiple so it doesn't look like we can hook into it. I even tried firing a plugin on retrieve multiple of any entity to see if it was just retrieving them under a different entity name - but this does not seem to be the case.

    If you change the selection from 'Related Regarding Records' to 'This Record Only' it will then hit the plugin (as it's not getting records from other places now).

    For now I'm not seeing a way to hook into this message.

    An alternative approach might be to add a custom subgrid to your form or left-nav, and hide the default Activities nav-items. However this would mean having to recreate all the related regarding joins.

    I'll keep investigating as I share a common interest in this one.

    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


    Thursday, August 8, 2013 7:50 AM
  • You could also default that 'Include' option to 'This Record Only' instead of adding a new relationship and trying to hide the existing ones etc.

    You would still need to recreate any of the existing 'related regarding' entities to your custom query if needed, however this will at least allow you to keep the functionality that displays emails for example that are to/from the contact without being set regarding.

    Here is a code example of how to change the default 'Include' option:

    function filterActivities() {
        document.getElementById("navActivityHistory").onclick = function () { loadActivities(this, "areaActivityHistory"); };
        document.getElementById("navActivities").onclick = function () { loadActivities(this, "areaActivities"); };
    
        function loadActivities(element, areaName) {
            Mscrm.Details.loadArea(element, areaName);
    
            document.getElementById(areaName + "Frame").onload = function () {
                var entityName = Xrm.Page.data.entity.getEntityName();
                var entity = entityName.charAt(0).toUpperCase() + entityName.substr(1);
                var doc = this.contentWindow.document;
                var viewControl = doc.getElementById("crmGrid_" + entity + "_ActivityPointers_ViewControl");
    
                viewControl.value = "ImmediateRelatedView";
    
                var evt = document.createEvent("HTMLEvents");
                evt.initEvent("change", false, true);
                viewControl.dispatchEvent(evt);
            };
        }
    }

    You should then be able to hook into the activitypointer retrievemultiple as usual. However as mentioned you would need to recreate the other 'related regarding' entity filters if you take this approach.

    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

    Thursday, August 8, 2013 8:34 AM
  • Hi Paul,

    Thank you very much for your thoughtful explanation and resolution to this problem. I will share this with our team to see if they want to take this approach or leave the Rollup message as is.

    Thank you again for your quick response. Have a wonderful day.

    Homayoun

    Thursday, August 8, 2013 4:06 PM