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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to change type of ...
Power Automate
Answered

How to change type of variable in JS

(0) ShareShare
ReportReport
Posted on by 21

Hi Everyone!

I have a JS, that return me an array

 

 

function getRequests() {
 let searchInSubject = "request"
 let searchInSubjectArray = searchInSubject!==null ? searchInSubject.split(',') : [];
 let content = document.getElementById("frame_content").contentDocument.body.innerHTML;
 let requestLinksArray = [...content.matchAll(/onmouseover[^>]*(\/servicedesk\/view\/[0-9]{1,})[^>]*>([^>]*)<\/a>/g)];

 let result=[];

 for(let link of requestLinksArray)
 {
 let url = link[1];
 let subject = link[2];
 
 if(searchInSubjectArray.length==0)
 {
 result.push([url, subject])
 continue;
 }
 
 for(let search of searchInSubjectArray)
 {
 if(subject.toLowerCase().indexOf(search.toLowerCase().trim())>=0)
 {
 result.push([url, subject])
 break;
 }
 }
 }
 
 return result;
}

 

 

I used "Run JavaScript function on web page" activities, but it returns me Text.

 

I wanted to use after "For each" activities, but it don't work with text.

What I need to do to resolve this problem?

 

Thanks in advance!

I have the same question (0)
  • Verified answer
    tkuehara Profile Picture
    667 on at

    Hi @Akobir 

     

    You can change your variable to a list by splitting your text result.

    tkuehara_0-1626701315810.png

     

  • Akobir Profile Picture
    21 on at

    I thought that it can have easier solution. 🙂

    Ok, thanks!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 632

#2
Haque Profile Picture

Haque 458

#3
Valantis Profile Picture

Valantis 357

Last 30 days Overall leaderboard