web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / pass information from ...
Power Apps
Suggested Answer

pass information from model driven apps to custom pages

(1) ShareShare
ReportReport
Posted on by 6
I have a model driven app in which i have a form with columns Case ID and Name on the command bar i have a button named Trigger Email which will open the custom page which i created i want to add the particular case id of the form to the custom page on click of Trigger Email button. How can i do it
Categories:
I have the same question (0)
  • realwillwright Profile Picture
    772 Moderator on at
    Hi,
     
    You need to set up the JS which sounds like you have already done as a web resource, similar to below. Then within the OnStart of the app/page you need to add a variable to use the RecordId passed to it.
     
    function LoadCustomPage (executionContext) {
    var formContext = executionContext.getFormContext();
    var recordId = formContext.data.entity.getId();
    
    //var selectedRecord = executionContext.getFormContext().data.entity;
    //var recordId = selectedRecord.getId().replace(/[{}]/g, ""); 
    
    // Inline Page
    var pageInput = {
        pageType: "custom",
        name: "xxxxx_custompage_xxxxx",
        entityName: "msdyn_cases",
        recordId: recordId,
    };
    var navigationOptions = {
        target: 2, 
        position: 2,
        width: {value: 500, unit: "px"},
        title: "All Answers"
    };
    Xrm.Navigation.navigateTo(pageInput, navigationOptions)
        .then(
            function () {
                // Called when page opens
            }
        ).catch(
            function (error) {
                // Handle error
            }
        );
    }
    Added to OnStart in custom page
     
    Set(gblRecordId, Param("recordId"));
     
    Finally you can then lookup the case details using the GUID in the variable
  • Jayakanth_Reddy Profile Picture
    6 on at
    Hi,
    Thanks for the help i am getting error when i try to access the custom page i have attached the image for the same and below is the javascript code to which i have done minor changes
     
    function redirectToCanvasApp(primaryControl) {
        try {
     
            var formContext = primaryControl;
            var claimId = formContext.data.entity.attributes.get("dv_name").getValue();
            if (!claimId) {
                console.error("Claim ID not found.");
                return;
            }
            console.log("Fetched Claim ID: " + claimId);
            var pageInput = {
                pageType: "custom",
                name: "dv_emailresponse_1de4f",  
                entityName: "dv_workqueue",  
                data: { claimId: claimId }  
            };
            var navigationOptions = {
                target: 2,  
                position: 1,
                width: { value: 800, unit: "px" },
                title: "Claim Email Response"  
            };
            Xrm.Navigation.navigateTo(pageInput, navigationOptions)
                .then(function() {
                    console.log("Navigation successful.");
                })
                .catch(function(error) {
                    console.error("Error navigating to custom page: ", error);
                });
     
        } catch (error) {
            console.error("An error occurred in redirectToCanvasApp: ", error.message);
        }
    }
  • Jayakanth_Reddy Profile Picture
    6 on at
  • FemaleMarvel365 Profile Picture
    57 on at
    Are you passing a variable via form?? If so which one ? I’m using a command button, that uses JavaScript, passing a parameter from the command parameter dropdown and it opens my custom page but it’s not getting the record guid.
     
    Also does anyone get the error invalid data from network and error when trying to retrieve data from network. Do I need to do something specific feature or permissions wise to get past these errors. Any assistance I would appreciate 
  • Gabriel G. Profile Picture
    831 Super User 2025 Season 2 on at
    If you use the command bar to trigger your custom page, you need to pass 'PrimaryItemIds' if you want to work on the current record. What is the type from the parameter you pass from your command bar ? Maybe you simply not passing a good parameter schema.

    _____________________________________
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
  • CU22021931-0 Profile Picture
    7 on at
    function OpenCustomPage(str)
    {
    var pageInput = {
        pageType: "custom",
        name: "custom page name",
       entityName: "tablename",
       recordId: str
    };
    var navigationOptions = {
        target: 2, 
        position: 2,
        width: {value: 500, unit: "px"},
        title: "page title"
    };
    Xrm.Navigation.navigateTo(pageInput, navigationOptions)
        .then(
            function () {
                // Called when the dialog closes
            }
        ).catch(
            function (error) {
                // Handle error
            }
        )
    }
  • Suggested answer
    CU22021931-0 Profile Picture
    7 on at
    @GabGadou Your answer worked. its passing in the record now. hoping that I don't get the network error now
     
    If you use the command bar to trigger your custom page, you need to pass 'PrimaryItemIds' if you want to work on the current record. What is the type from the parameter you pass from your command bar ? Maybe you simply not passing a good parameter schema.

    _____________________________________
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard