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

Community site session details

Session Id :
Power Apps
Unanswered

CUSTOM PAGES

(1) ShareShare
ReportReport
Posted on by 14
Custom page isn't receiving data from javascript. Console log shows everything correctly.
I have the same question (0)
  • mmbr1606 Profile Picture
    14,558 Super User 2025 Season 2 on at
    CUSTOM PAGES
    hey
     
     
    you need to give us more details of code and maybe screenshots of your app. what is not working?which errors are u seeing?
     
     
    cheers
  • EricaB-I.T. Profile Picture
    14 on at
    CUSTOM PAGES
    I was able to add script and screenshots.
  • EricaB-I.T. Profile Picture
    14 on at
    CUSTOM PAGES
    function openPlanOfActionPage(isNew, customerRecordId, planOfActionRecordId = "") {
        // Log whether we're creating a new record or editing an existing one
        console.log("Is New Record:", isNew);
     
        // Verify that customerRecordId and planOfActionRecordId are strings
        if (typeof customerRecordId !== 'string') {
            console.warn("Warning: customerRecordId is not a string. Converting to string:", customerRecordId);
            customerRecordId = String(customerRecordId); // Convert to string if needed
        }
        if (typeof planOfActionRecordId !== 'string') {
            console.warn("Warning: planOfActionRecordId is not a string. Converting to string:", planOfActionRecordId);
            planOfActionRecordId = String(planOfActionRecordId); // Convert to string if needed
        }
     
        // Log the Customer Record ID and Plan of Action Record ID (if editing)
        console.log("Customer Record ID (for linking to new record):", customerRecordId);
        console.log("Plan of Action Record ID (if editing existing record):", planOfActionRecordId);
     
        // Set up the page input
        var pageInput = {
            pageType: "custom",
            name: "eb_planofaction_1ca91", // Logical name of the custom page
            entityName: "eb_planofaction",    // Logical name of the Plan of Action table
            recordId: isNew ? "" : planOfActionRecordId.replace(/[{}]/g, "") // Only set recordId if editing an existing Plan of Action
        };
     
        // If creating a new record, pass the Customer ID as a parameter
        if (isNew) {
            pageInput.parameters = { customerId: customerRecordId.replace(/[{}]/g, "") };
        }
     
        // Log the complete page input object to verify all details
        console.log("Page Input Object:", JSON.stringify(pageInput));
     
        // Set up navigation options
        var navigationOptions = {
            target: 1, // Open in a new page
            width: 800, // Set the width of the dialog
            height: 600 // Set the height of the dialog
        };
     
        // Log the navigation options to ensure they are correctly configured
        console.log("Navigation Options:", JSON.stringify(navigationOptions));
     
        // Attempt to navigate to the page
        Xrm.Navigation.navigateTo(pageInput, navigationOptions)
            .then(function () {
                console.log("Navigation to custom page successful.");
            })
            .catch(function (error) {
                console.log("Error navigating to custom page:", error);
            });
    }
     
    // Usage example: Open a new Plan of Action for a specific Customer
    function openNewPlanOfActionForCustomer(executionContext) {
        var formContext = executionContext.getFormContext(); // Get the current form context
        var customerRecordId = formContext.data.entity.getId(); // Get the Customer record's GUID
     
        // Log to confirm we're opening a new Plan of Action with the correct Customer ID
        console.log("Opening new Plan of Action for Customer Record ID:", customerRecordId);
     
        // Open a new Plan of Action and pass the Customer record ID as a parameter
        openPlanOfActionPage(true, customerRecordId);
    }
     
    // Usage example: Open an existing Plan of Action
    function openExistingPlanOfActionForCustomer(planOfActionRecordId) {
        // Log to confirm we're opening an existing Plan of Action
        console.log("Opening existing Plan of Action with Record ID:", planOfActionRecordId);
     
        // Open an existing Plan of Action by passing the Plan of Action record ID
        openPlanOfActionPage(false, "", planOfActionRecordId);
    }
  • EricaB-I.T. Profile Picture
    14 on at
    CUSTOM PAGES
    Hello, 

    I have model driven app for Customer's. Within the app is a subgrid for the Plan of Action table.  I created a Custom Page that IS opening when the button is pressed, the data is showing up in the Console, however, it is NOT flowing to my custom page. I have screenshots of the console, button parameters, and custom page in the attachment.  My OnVisible property is set to: 
    Set(
        CustomerRecordId,
        If(
            !IsBlank(Param("Customer Id")),
            Param("Customer Id"),
            "No CustomerRecordId proved."
        )
    );

    // Log to check if CustomerRecordId is set correctly
    If(
        !IsBlank(CustomerRecordId),
        Notify("CustomerRecordId: " & CustomerRecordId),
        Notify("No CustomerRecordId provided.")
    );
  • EricaB-I.T. Profile Picture
    14 on at
    CUSTOM PAGES
    I guess it was too long if I put everything in one post? Anyway, my parameters set on the button :  Param 1 Boolean>true; Param 2 FirstPrimaryItemId; Param 3 SelectedControlSelectedItemIds    
     
    Here is the console log
  • EricaB-I.T. Profile Picture
    14 on at
    CUSTOM PAGES
    Here is how the app comes across after the click. 
  • bscarlavai33 Profile Picture
    738 Super User 2025 Season 2 on at
    CUSTOM PAGES
    Is it a Power Apps Custom Page or an html/js web resource custom page?
  • EricaB-I.T. Profile Picture
    14 on at
    CUSTOM PAGES
    It's a Power Apps Custom Page.

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 836 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 231 Super User 2025 Season 2

Last 30 days Overall leaderboard