get the activities of account and also account related to system entity and custom entity RRS feed

  • Question

  • Hi all;

    i want to show the activites of account and also the the account related to system entities or custom entitites for example ithe account has a relationship with two custom entities i want to have a grid on account which show the activities of those custom entities i hope you understand my question

    Wednesday, September 16, 2015 7:10 AM

All replies

  • 1. create subgrid of activity on from without any filter.

    2. Then override subgrid by below code. change fetch query according to you.

    3. call this function onload of from.


    filterSubGrid() {

    varworkflowTemplatetValue = Xrm.Page.getAttribute("ymf_workflowtemplateid").getValue(); //field to filter by


    varworkflowTemplatetGrid = document.getElementById("WorkflowTemplateSteps"); //grid to filter


    if(workflowTemplatetGrid == null) { //make sure the grid has loaded


    function() { filterSubGrid(); }, 2000); //if the grid hasn’t loaded run this again when it has






    varworkflowTemplatetValueid = "00000000-0000-0000-0000-000000000000"; //if filter field is null display nothing


    if(workflowTemplatetValue != null) {

            workflowTemplatetValueid = workflowTemplatetValue[0].id;



    //fetch xml code which will retrieve all the accounts related to the contact


    varfetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"+


    "  <entity name='ymf_workflowtemplatestep'>"+


    "    <attribute name='ymf_name' />"+


    "    <attribute name='ymf_code'/>"+


    "    <attribute name=ymf_workflowtemplatestepid' />"+


    "    <order attribute='ymf_code' descending='false' />"+


    "    <filter type='and'>"+


    " <condition attribute='statecode' operator='eq' value='0' />"+


    " <condition attribute='ymf_workflowtemplateid' operator='eq'  value='"+ workflowTemplatetValueid + "' />"+


    "    </filter>"+


    "  </entity>"+




    "fetchXml", fetchXml); //set the fetch xml to the sub grid  


    //refresh the sub grid using the new fetch xml


    Hope this helps. ----------------------------------------------------------------------- Santosh Bhagat If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

    Wednesday, September 16, 2015 11:38 AM
  • Hi thanks for your reply

    that is  i know that i can use fetch xml for subgrid, the thing is that i am unable to write the fetch xml which brings all the activites of the entities which has the account link to it and sho it on account form 

    Wednesday, September 16, 2015 12:51 PM