taarskog / crm-powerbi-viewer

Embed tiles and reports from Power BI into Dynamics CRM Forms and Dashboards.
http://crm-powerbi-viewer.heiigjen.com/
MIT License
27 stars 10 forks source link

Can't get Opportunity record filtering to work #56

Open thomashager opened 5 years ago

thomashager commented 5 years ago

Hi, I'm truggling to get the filtering of a report on my Opportunity form to filter according to the active record. I'm sure I'm just missing something that would be obvious if you know your way around things a bit better. Would really appreciate some guidance. This is what I have;

  1. I have setup a javascript web resource; window.Samples = window.Samples || {}; Samples.Filters = Samples.Filters || {};

/**

  1. I have referenced it in the config; // Sample: custom_scripts: ["../../newmyfilter?ver=1", "../../demo/powerbi/filters/account.js?ver=1"] custom_scripts: ["https://tocdev.crm4.dynamics.com//WebResources/new_Samples.Filter.FilterOnOpportunity"] };

  2. I have added a web resource to the Opportunity form with the following custom parameter data; type=report&id=2dba7575-b09d-4193-94b8-e2674169950e&groupId=566c3e94-3cda-48ff-aaad-362633f833c8&pageName=&showFilterPane=true&showNavPane=true&customFn=Samples.Filter.FilterOnOpportunity

The reports shows but is not filtered.

Have been struggling for a while and would really appreciates some idea on what I'm missing. Many thanks!

taarskog commented 5 years ago

Looks like you have a typo in the parameter data when referencing the customFn. You have: customFn=Samples.Filter.FilterOnOpportunity but based on your code it should be (plural filters): customFn=Samples.Filters.FilterOnOpportunity

thomashager commented 5 years ago

Thanks for the quick help! I changed so the reference is now correct, but I must have made some other mistake as well because it is still not filtering. I have tried to double check everything, but still not filtering. Any other ideas?

taarskog commented 5 years ago

Could be multiple issues and hard to say without access. A few things to verify:

  1. Have you verified that there are no error messages in the console log?
  2. Add a log call to the console at the very top of your javascript to verify that the file is actually being loaded.
  3. Did you really mean to filter only when the page has changed or also on initial loading of the report? Now you need to change page before the filter kicks in.
  4. Is it correct that the table name and the column name are equal?
  5. Is the casing of table and column names correct?
  6. ...
thomashager commented 5 years ago

Hi, I found a few errors in the log - but after working through it a bit it looks clean now (see below); image

I added a log call as you proposed that made it into the log ("test log") in the picture. I actually took the change page part out of it. I guess that was just a "copy" mistake. When I look in Power BI Desktop for constructing the reports the name of the table is Opportunity and also the Column for the Opportunity rec ID as far as I can understand. They both have a capital O so it looks right so far.

Still not filtering though. Feels like I'm getting closer though.

Any additional ideas?

Many thanks!

thomashager commented 5 years ago

Today I tried a few more things and one of the errors in the log came back. Maybe this can be the issue;

image

Hopefully it means something more to you than me...