Customer Engagement & Dynamics CRM Forum

Open related record in modal/dialog in forecast underlying records view using JavaScript

  • 1.  Open related record in modal/dialog in forecast underlying records view using JavaScript

    Posted 19 days ago
    Edited by Niels Søgaard Lønberg 19 days ago
    Under advanced settings, when configuring a forecast, it is possible to ad JavaScript library for advanced configuration of editability of fields in the underlying records grid view.

    In the underlying records view in a forecast, there is this great 'Navigate' button (please make this option available this for standard sub-grids, Microsoft), which will open the record in a modal/dialog (more here in @Jukka Niiranen's blog), so the user doesn't navigate away from the forecast.

    However, the issue in our case is, that we are not using the Opportunity entity as the rollup entity in the forecast - but instead a related entity named Opportunity finance. That means, that the user will open the Opportunity finance record when they click on the 'Navigate' icon in the underlying records grid view instead of the Opportunity records - which is the record it makes sense for the user to open and edit.

    So I am wondering, if it is possible, using JavaScript, to change which which record and entity the 'Navigate' button opens, e.g. based on another column in the view.

    Looking at the documentation for opening an existing record (even though that is for a lookup field, and not a sub-grid), it seems that it might be possible using something similar to the code example from the documentation page if that could be combined with the OnRowLoad event.
    var pageInput = {
        pageType: "entityrecord",
        entityName: "account",
        formType: 2,
        entityId: "5a57f2c3-5672-ea11-a812-000d3a339706" //replace with actual ID
    var navigationOptions = {
        target: 2,
        width: {value: 80, unit:"%"},
        position: 1
    Xrm.Navigation.navigateTo(pageInput, navigationOptions);​

    This is where I hit the wall, and I'm hoping someone with a bit more expertise in JavaScript can help. It might not be possible at all, however I want to give it a try.

    Any input is appreciated. 

    Niels Lønberg
    Digital Sales Specialist
    Semco Maritime

If you've found this thread useful, dive deeper into User Group community content by role