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)

Insert FetchXml into subgrid chart's view using javascript.

(0) ShareShare
ReportReport
Posted on by 335

I1643.Capture.JPG"/resized-image.ashx/__size/550x0/__key/CommunityServer-Discussions-Components-Files/117/8284.Capture.JPG" border="0" />

 

Here is my code:

function UpdateSubGrid() {
 var accountSales = document.getElementById("SalesSummary");
 if (accountSales.readyState != "complete") {
  setTimeout('UpdateSubGrid()', 1000);
  return;
 }

 var accID = Xrm.Page.data.entity.getId();
alert(accID);

 var accountNum = Xrm.Page.getAttribute("jensen_accountnumber").getValue();

 var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>";
  fetchXml += " <entity name='account'>";
  fetchXml +=  " <attribute name='jensen_yeartodatesales' />";
  fetchXml +=  " <attribute name='jensen_yeartodateplan' />";
  fetchXml +=  " <attribute name='jensen_lastyearsales' />";
  fetchXml +=  " <attribute name='name' />";
  fetchXml +=  " <filter type='and'>";
  fetchXml +=  " <condition attribute='statecode' operator='eq' value='0' />";
  fetchXml +=  " <condition attribute='accountnumber' operator='eq' value='";
  fetchXml +=  accountNum;
  fetchXml +=  "' />";
  fetchXml +=  " </filter>";
  fetchXml +=  " <order attribute='name' descending='false' />";
  fetchXml +=  " </entity></fetch>";
alert(fetchXml);

accountSales.control.setParameter("fetchXml", fetchXml);

accountSales.control.refresh();
}

Here is the Account form with the subgrid that has the chart in it, highlighted:

This chart us showing ALL accounts rather than being filter to the account I'm in.  The new fetchXml that I'm trying to assign it did not get set.

*This post is locked for comments

I have the same question (0)
  • Mohammad Atif Profile Picture
    on at

    Hi Cory,

    Are you getting this error message while navigating to the CRM Application? Like clicking on Customization>System settings> Entity>Clicking on new entity

    Or while creating a new user In CRM 2011

    Regards,

    Mohammad

  • Cory Bonallo Profile Picture
    335 on at

    Neither.  I have added the above chart and custom control to the Accounts main form.  I get this when I open the main form in accounts.  The error is related to trying to assign the fetchXml to the subgrid on the Account form.

  • Mohammad Atif Profile Picture
    on at

    1      Go to Control Panel

    2.     Look for Microsoft URL Rewrite Module 1.1 for IIS 7

    3.     Please uninstall this

    4.     Do IISRESET

    5.     Re-install Microsoft URL Rewrite Module 1.1 for IIS 7

    a.     Take your CRM Install Disk, Browse for UrlRewrite Folder.

    6.     IISRESET

    7.     Browse your CRM

    Thanks,

    Mohammadf

  • Cory Bonallo Profile Picture
    335 on at

    Hmm... Ok.  I will try this on our dev CRM server.  I am doing this on the CRM server, not the clinet?

  • Mohammad Atif Profile Picture
    on at

    Hi Cory,

    Yes, this is only for the Server and not for the client. If you do not want to uninstall the URL Rewrite module you may try to repair it from the add and remove program.

    Thanks,

    Mohammad

  • Cory Bonallo Profile Picture
    335 on at

    Still getting error.  Do I have the right version of this file:

     

    Microsoft URL Rewrite Module 1.1 for IIS 7

    {7BB38DF8-E383-4145-8410-D167757B4B63}

    10/26/2010

  • Cory Bonallo Profile Picture
    335 on at

    Oh, and I did unistall and reinstall.

  • Cory Bonallo Profile Picture
    335 on at

    I discovered what I had done wrong.  I had the name of the function incorrect.  I did not know it had to match the name of the function inside the liabrary.  Once I got that fixed the fetchXml did start working.  However, even though it is working, I get the following error:

     

    Anyone seen this before?

  • Mohammad Atif Profile Picture
    on at

    What is the update rollup installed ?Do you have activity feeds installed and configured?

    Thanks,

    Mohammad

  • Cory Bonallo Profile Picture
    335 on at

    This is the like that is causing the error:

    accountSales.control.refresh();

    We have RU 6 installed and I don't know about activity feeds.  Does it come with a default installation?

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