Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Need some help on Model-driven PowerApps

(0) ShareShare
ReportReport
Posted on by 362

Hello everyone,

Hope I'm in the right forum to ask some help. I currently working on Model-driven app which need to use Custom Page. I'm learning about calling Custom Page from Model-driven and ran into this page -> Navigating to and from a custom page in your model-driven app using client API - Power Apps | Microsoft Docs

This example uses the recordId parameter within the navigateTo function to provide the custom page with the record to use. The Param function within the custom page retrieves the value and uses the Lookup function to retrieve the record.

The steps are : 

  1. Create a web resource of type JScript and update the name parameter to be the logical page name. Add the following code to the web resource.

    JavaScriptCopy
    function run(selectedItems)
    {
        let selectedItem = selectedItems[0];
    
        if (selectedItem) {     
            let pageInput = {
                pageType: "custom",
                name: "<logical page name>",
                entityName: selectedItem.TypeName,
                recordId: selectedItem.Id,
            };
            let navigationOptions = {
                target: 1
            };
            Xrm.Navigation.navigateTo(pageInput, navigationOptions)
                .then(
                    function () {
                        // Handle success
                    }
                ).catch(
                    function (error) {
                        // Handle error
                    }
                );
        }
    }
    
  2. Customize the table ribbon CommandDefinition for OpenRecordItem to call the function above and include the CrmParameter with the value SelectedControlSelectedItemReferences.

    XMLCopy
        <JavaScriptFunction FunctionName="run" Library="$webresource:cr62c_OpenCustomPage">
            <CrmParameter Value="SelectedControlSelectedItemReferences" />
        </JavaScriptFunction>
    

I understood about step 1, but what is step 2 meant? at which object and where should I go, and what exactly I should do ? Please help.

Thanks

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 8,699 Super User 2024 Season 1 on at
    RE: Need some help on Model-driven PowerApps

    Hello,

    It is limitation of the CRM. Because this settings are OOB and it is handled by the CRM internally.

    I guess you can use Modal forms which can open as a popup in the same page. if you have records on the main form.

    knowledgefrommanish.com/.../

    else you can add a New tab on the form and show your custom page.

    Thank you,

    Amit Katariya

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Need some help on Model-driven PowerApps

    Hi,

    Unfortunately you can not achieve what you need. Hyperlink on View controled by internal microsoft code which we don't have access to.

    You should embedd your custom page inside CRM form/Add Ribbon button to let the user open your custom page.

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • Teevo Profile Picture
    Teevo 362 on at
    RE: Need some help on Model-driven PowerApps

    Hi,

    How to go to that ribbon workbench ? I'm sorry but I never use this and pretty blank about CRM

    pastedimage1651831749960v1.png

    Thanks

  • Teevo Profile Picture
    Teevo 362 on at
    RE: Need some help on Model-driven PowerApps

    Hello everyone,

    Appreciate any thought on this.

    Thanks

  • Teevo Profile Picture
    Teevo 362 on at
    RE: Need some help on Model-driven PowerApps

    Hi Amit,

    I'm actually want my Custom Page to be open when I'm clicking the row in the Model-driven View it self. Is this possible ?

    You know when we have this kind of View when choose some of the menu ->

    pastedimage1651736736701v1.png

    So in that specific record (row), it used to open it's form, but I've created a Custom Page for the record so I would like this one to be shown instead.

    Thanks for your reply.

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 8,699 Super User 2024 Season 1 on at
    RE: Need some help on Model-driven PowerApps

    Hello,

    It explains to provide the parameter to your JS code when user will click on the Button. Now this button can be present on Any ribbon like Main form, View level as well as Sub grid level. you will need to add this button depending on you requirement.

    Please follow below instructions for the same as I am adding a button on the Main form and passing this parameter to My JS.

    1. GO to ribbon workbench and open this button. then click on the command associated with this button.

    pastedimage1651735803840v1.png

    Can you let me know from where you want to open this custom page? Like on Sub-grid Button click or Form Button Click ?

    Thank you,

    Amit Katariya

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans