Opening a custom page from the Power Fx command bar!

Sdílet
Vložit
  • čas přidán 24. 07. 2024
  • In Today’s Power Short, Tom Moore explains how to open a custom page from your model driven applications using the new Power Fx command bar designer.
    This video helps you understand how you can use Power Fx with custom pages to leverage the data from within your model driven forms.
    Not only does this hugely increase the potential of your day-to-day working apps but also means, that if you are licensed on the £3.80 per user per month license, there's no extra licensing requirement! 😱
    #P365 #power365solutions #Microsoft #Dynamics365 #Office365 #Powerplatform #Sharepoint #Microsoftconsultancy #PowerShorts #TipsandTricks
    Java Script:
    function onLoad(e)
    {}
    //------ This is the function that you will call when you create the button, I name them accordingly. ------//
    function PowerShortButton(e)
    {
    var formContext = e;
    var thisId = formContext.data.entity.getId().replace("{", "").replace("}", "");
    debugger;
    // Centered Dialog
    var pageInput = {
    //------ This is how the button knows what you are trying to access. There is documentation on microsoft docs (google: xrm.navigation) on the pageType(s) that you can use, in this instance I am launching a custom page -----//
    //------ The key information is the name, and table name. You want to give it the name seen in the solution, note: once this is set you can't change it ------//
    //------ The entity name is the entity in which this item is referring to ------//
    //------ The Record ID is taken from var formContext above, this is how you will link it to that individual record in the table. ------//
    pageType: "custom",
    name: "p365_contactpopup_77b43",
    entityName: "contact",
    recordId: thisId
    };
    //------ Set the navigation options. Note: Position defaults to 1 (modal) but you can choose 2 (side pane, right hand side). -------//
    //------ Also note that you can use percentages for the width and height units. This is handy for this application, It means that it will change depending on screen size ------//
    //------ The title will be what is displayed in the top bar ------//
    var navigationOptions = {
    target: 2,
    position: 1,
    width: {
    value: 90,
    unit: "%"
    },
    height: {
    value: 90,
    unit: "%"
    },
    title: "Contact Viewer"
    };
    //------ This is where the magic happens. Documentation available on microsoft docs, I google xrm.navigation and it was the first result. ------//
    Xrm.Navigation.navigateTo(pageInput, navigationOptions).then();
    }
  • Věda a technologie

Komentáře • 10

  • @dlutchner
    @dlutchner Před rokem +1

    Excellent work. Just what I needed. Now I have the ability to pass the record ID to my Power Automate flow (via the Custom Page).

  • @paragchapre399
    @paragchapre399 Před 6 měsíci

    Very nice video and good explanation.

  • @power365solutions8
    @power365solutions8  Před rokem

    Comment below if there are any subjects you would like us to tackle in our upcoming Power Shorts!

    • @Alots
      @Alots Před 8 měsíci

      I want to trigger script code from power app flow (pass and get value)

  • @gonzalogalvan5168
    @gonzalogalvan5168 Před rokem

    Hi, great video! can I capture the value of a custom page field and use ir in a variabel on the js code?

  • @magnusjeppesen
    @magnusjeppesen Před 10 měsíci

    Really awesome :)
    However when trying to do thin on the Main Grid (instead of Main Form), I cannot pass the parameters to the CustomPage
    The parameters are available in the javascript, but nothing is passed to the custom page. There's no issue when I make almost the same setup in a Main Form, but when doing it on a Main Grid, the parameters are lost somewhere between the javascript and the custom page.
    I even tried to make a static variable in the javascripts, which wasn't passed into the custom page.
    Also tried making a static string parameter on the Main Grid Command Button configuration, which also wasn't passed into the custom page.
    Any ideas?

  • @merknator
    @merknator Před rokem

    Is there a way to add this button to a sub-grid of the contacts child? So if I were to patch a new child and need this contact value to set regarding of the child, I could

  • @josephlim2064
    @josephlim2064 Před rokem +1

    Hi Tom, if the button is added on the main grid, is it possible to pass the viewid or the url to the custom page via the javascript?

    • @power365solutions8
      @power365solutions8  Před rokem

      Hi Joseph, thank you for getting in touch.
      The method we have used in the video is opening a custom page in the context of a form. You can open a custom page from the context of the main grid, however there are a few changes that you will want to make. Unfortunately we don't currently have any examples on how to do this but it is something we are planning on doing in the future.