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 Platform Community / Forums / Power Automate / Run JavaScript functio...
Power Automate
Unanswered

Run JavaScript function on web page

(0) ShareShare
ReportReport
Posted on by 12

Hello,

I am trying to checking checkboxes in a range from 1 to 2000  using Run JavaScript function on web page action. The script runs without errors, but the checkboxes are not getting checked.

 

JavaScript Code I am Using:

function ExecuteScript() { 
    // Define the start and end indices for the range
    var startIndex = 1; // Start index (1-based)
    var endIndex = 2000;   // End index (1-based)
    // Loop through the range of checkboxes
    for (var i = startIndex; i <= endIndex; i++) {
        // Construct the dynamic selector for each checkbox
        var selector = "#imageRepeater__ctl" + i + "_chkAssign";
        
        // Find the checkbox element
        var checkbox = document.querySelector(selector);
        
        // If the checkbox exists, check it
        if (checkbox) {
            checkbox.checked = true;
        }
    }
}

 
  • No Errors: The script runs without errors, but the checkboxes are not getting checked.
  • I Tried: I tested the JavaScript code directly in the browser's Developer Tools Console, and it works when checking individual checkboxes (e.g.,
    // Define the range of checkboxes to select
    var startIndex = 1; // Start index (1-based)
    var endIndex = 3;   // End index (1-based)
    // Loop through the range and select the checkboxes
    for (var i = startIndex; i <= endIndex; i++) {
        var selector = "#imageRepeater__ctl" + i + "_chkAssign"; // Dynamic selector
        var checkbox = document.querySelector(selector); // Find checkbox
        if (checkbox) {
            checkbox.checked = true; // Check the checkbox
            console.log("Checked: " + selector);
        } else {
            console.log("Checkbox not found: " + selector);
        }
    }

     
    ).
  • Browser Attachment: The browser is launched using the Launch Browser action.
Categories:
I have the same question (0)

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 Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard