locked
How to access the Html object on call of a button on Ribbon? RRS feed

  • Question

  • hi All,

    we have a requirement where, We need to show a html page on home grid, which shows the expenses of an employee for the given month.  my requirement is to show another page for selected records. this needs to perform from button which is available on home page ribbon. based on selected records.

    so my question is how to access the object of selected records from the button which is present in the home page ribbon?

      for reference I have attached the image, as you can see below 

    Expense

    Thanks & regards!

    Subhash Mahato




    Tuesday, August 6, 2013 5:03 AM

Answers

  • Great - can you mark the answer on this thread so it is closed off.

    Thanks!


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Thursday, August 8, 2013 3:04 PM
    Answerer

All replies

  • Hi,

    Your HTML page is loaded into the ContentIFrame IFRAME element - so you should be able to get it using

    window.top.window.contentIFrame

    This is off the top of my head - so you might need to use the F12 debugger to check it out.

    You can then register some call back functions such as 'getSelectedItems' on your embedded window which you can call from your ribbon javascript.

    hth


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Tuesday, August 6, 2013 8:45 AM
    Answerer
  • Hi Subhash,

    You need to write another script , call the new scripts on the button click way you can pass the CRM parameters in this you need to select (selectedcontrolsselecteditemIds) so that you will get the selected record id's to the new scripts as function parameter .

    Regards,

    PavanJoshi

    www.Dynamicsexchange.com

    www.mtccrm.com

    Tuesday, August 6, 2013 10:40 AM
  • Hi Scott,

    Thanks for your reply, I was able to access html table using "window.top.window.contentIFrame" while on home page script, but not able to access the object while it opens the new page from the given button. can you give a further hint, 

    Thanks!

    Tuesday, August 6, 2013 11:27 AM
  • Hi Pavan,

    thanks for your reply,

    This is not a entity grid but a html page, where we cannot use the "selectedcontrolsselecteditemIds".

    thanks!

    Subhash

    Tuesday, August 6, 2013 11:29 AM
  • Hi Subhash,

    If you are using the OpenWindow Ribbon Action then perhaps the easiest way would be to run a script in the opened window that registers it's self with the opening ribbon window using window.opener.myOpenedWindow = window;

    You can then reference this object on subsequent clicks of the ribbon. 

    hth


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Tuesday, August 6, 2013 11:33 AM
    Answerer
  • Hi Scott,

    Thanks again, for your suggestion as you said, I did same thing but while I tried to access object on newly open window using below two method, 

    1) window.top.opener 

    2) window.parent it gives the url of web resource and not (home page) where the button present

    3) if I try  window.parent.parent it gives the same url that is web resource url of the second html page.

    can you further elaborate what you want say by this "opening ribbon window using window.opener.myOpenedWindow = window;", Am I doing anything wrong?

    Thanks!

    Subhash

    Tuesday, August 6, 2013 2:23 PM
  • Hi Subhash,

    Before you can access the new window from the parent window, you'll need to add an onload function on the new window that sets a reference to it's self on the opening window using window.opener.myOpenedWindow = window.

    hth


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Tuesday, August 6, 2013 2:29 PM
    Answerer
  • done.

    Thanks!

    Thursday, August 8, 2013 8:39 AM
  • Great - can you mark the answer on this thread so it is closed off.

    Thanks!


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Thursday, August 8, 2013 3:04 PM
    Answerer