Thanks
I was able to resolve this and set the page dynamically.
Instead of fetching the page using page name as mentioned in my intial post, I got an array of all the pages and then set whichever page needs to be active.This worked.
My previous code:
const page = report.page(pageName);
page.setActive();
My current code:
var pages = [];
report.getPages().then(function (reportPages) {
pages = reportPages;
});
pages[1].setActive();
Hope this helps someone visiting here for the same issue.