Answered by:
CRM 2011 Refresh IFRAME and list in dashboard

Question
-
Hello guys,
I have a following situation:
I have a dashboard which has iframeand list. That list is showing my active custom entities.So, I would like to achive that my iframe refreshes itself every time the list is refreshed. For example, when I add new records, when I delete something, when I edit something, ...
I tried adding JavaScript code to the ribbon buttons that add/delete/edit the records and that works, but it is possible to double click on the item in the list and edit the record in that way. So after saving the changes, list refreshes but my iframe stays the same.
What is the best way to achive that iframe refreshes every time the list does?
Thanks in advance
Tuesday, August 20, 2013 10:25 AM
Answers
-
Hi Marin,
You can use an approach similar to the one used at http://andreaswijayablog.blogspot.com/2011/08/refresh-form-after-subgrid-changes-or.html to attach an event to the onrefresh event of the sub-grid.
The main issue with doing any JS on a dashboard is that there is no on load function like we have on a form so you end up having to add a button to the ribbon which the user must click to attach the event or add some initialisation code onto a custom EnableRule on a button to attach the event - which works but rhymes so badly with "Hack" that its almost not acceptable in my book.
- Proposed as answer by MJFPalmer Tuesday, August 20, 2013 1:46 PM
- Marked as answer by Marin Glibic Thursday, September 19, 2013 1:45 PM
Tuesday, August 20, 2013 11:06 AM
All replies
-
Hi Marin,
You can use an approach similar to the one used at http://andreaswijayablog.blogspot.com/2011/08/refresh-form-after-subgrid-changes-or.html to attach an event to the onrefresh event of the sub-grid.
The main issue with doing any JS on a dashboard is that there is no on load function like we have on a form so you end up having to add a button to the ribbon which the user must click to attach the event or add some initialisation code onto a custom EnableRule on a button to attach the event - which works but rhymes so badly with "Hack" that its almost not acceptable in my book.
- Proposed as answer by MJFPalmer Tuesday, August 20, 2013 1:46 PM
- Marked as answer by Marin Glibic Thursday, September 19, 2013 1:45 PM
Tuesday, August 20, 2013 11:06 AM -
I came to same conclusion, but I'm new to CRM so I thought maybe there is a way.
Is there any other approach to this issue? I'm also worried about this hack, so I'll try to do something with that iframe in order to register to refresh every time list refreshes.
Tuesday, August 20, 2013 12:30 PM -
Hi Marin,
Not really unfortunately. I don't think Microsoft really want us writing JavaScript to operate on dashboards (at least for now). You can try initialising the attach from an iframe as you suggest - its probably cleaner than doing it using ribbon buttons.
Tuesday, August 20, 2013 12:42 PM