locked
CRM 2011: Javascript conversion help for navigation item RRS feed

  • Question

  • Can anyone help me convert this bit of code please? There is a problem with the onclick and with the innerHTML I think.

    var navBarItem = document.getElementById("navServiceCon");
    var completeURL = " http://sql01/ReportServer?/Sandbox_MSCRM/Contract+Report%20&rs:Command=Render?type=1typename=account&id=" + Xrm.Page.data.entity.getId();

    if (navBarItem != null) {
        navBarItem.onclick = function () {
            openIsvWin(completeURL, false, -1, '');
        }
    }

    // change the name of the existing nav item
    var navContracts = Xrm.Page.ui.navigation.items.get("navContracts");
    if (navContracts != null) {
        var stext = Xrm.Page.ui.navigation.items.get("navContracts").innerHTML;
        stext = stext.replace("Contracts", "CRM Contracts");
        stext = stext.replace(">Contracts<", ">CRM Contracts<");
        Xrm.Page.ui.navigation.items.get("navContracts").innerHTML = stext;
    }

    Tuesday, October 22, 2013 8:35 AM

Answers

  • Found it! Should say ReportServer.... doh!!
    • Marked as answer by STHook Monday, October 28, 2013 4:48 PM
    Monday, October 28, 2013 4:48 PM

All replies

  • Have just found I can change the name of a navigation item easily through form customization so that solves one problem - the second part of the above code is not needed any more!

    Also found I can add a navigation link in form customization BUT using External URL and "http://sql01/ReportServer?/Sandbox_MSCRM/Contract+Report%20&rs:Command=Render?type=1typename=account&id=" + Xrm.Page.data.entity.getId()

    doesn't work. Should it be a web resource instead? Anyone got any examples?

    Tuesday, October 22, 2013 9:26 AM
  • Found an example here

    http://www.crmanswers.net/2013/03/dynamic-navigation-links-using.html#comment-form

    Now just need to edit the web resource to give me the guid for the URL.

    Anybody know how please?

    Tuesday, October 22, 2013 1:27 PM
  • Can anyone tell me what's wrong with this URL please?

    http://btl-sql/Reports?/Sandbox_MSCRM/ContractReport&rs:Command=Render&type=1&typename=Account&id=763952C3-431C-E111-A196-46B2F20DF2DD

    It goes to the reports area but not through to the Sandbox folder and the report itself. Maybe I am specifying the parameters incorrectly?

    Monday, October 28, 2013 4:39 PM
  • Found it! Should say ReportServer.... doh!!
    • Marked as answer by STHook Monday, October 28, 2013 4:48 PM
    Monday, October 28, 2013 4:48 PM