Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Microsoft Dataverse
Unanswered

Re-Writing URL Field via JS

(0) ShareShare
ReportReport
Posted on by 7

Hello 

 

keep getting null returned on this line:

var getFieldControl = window.parent.document.getElementById("aet_documents");

 

CallenAET_0-1628004296227.png

 

 

 

//Get Value works

var urlName = formContext.getAttribute("aet_documents").getValue();

 

Also is there a better way to use write this line:

 

getFieldControl.innerHTML = btnHTML;

 

btnHTML is comprised of: 

var btnHTML = "<a href='javascript: void(0);' onclick=\"window.open(\'" + url + "\', \'windowname1\'); return false;\" style='color:blue;text-decoration:underline !important'>" + description+"</a>";

 

 

Thanks for any insight!

 

 

 

Categories:
  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: Re-Writing URL Field via JS

    There is a URL type field in Dataverse. You could just use that and it will make the url a clickable link so you don't need to make a custom button.

  • CallenAET Profile Picture
    7 on at
    Re: Re-Writing URL Field via JS

    @cchannon , @ChrisPiasecki ,

     

    Thanks. Yes I am looking for something more robust than what I have that's for sure.

    My aim is/was to take the value of a URL field and make the link less unsightly. Its just the actual URL of the site that I want people to visit not descriptive text that is clickable. Ideally a dynamic href link where I control the url and the clickable text. The current URL field is populated via PowerAutomate on essentially a run-once trigger. So once the url value is written is unlikely to be overwritten.

     

    Thanks 

     

  • ChrisPiasecki Profile Picture
    6,389 Most Valuable Professional on at
    Re: Re-Writing URL Field via JS

    Hi @CallenAET,

     

    Can you describe a bit more what exactly you are intending to achieve? That way we can guide you toward the right supported Dataverse client API methods. As @cchannon mentioned, manipulating the Dom directly is unsupported, with the exception being if you're manipulating elements in your own custom HTML web resource.

     

    ---
    Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: Re-Writing URL Field via JS

    Dom browsing (including use of window.parent) is not supported in client script because Msft reserves the right to change the Dom structure at any time and without notice. In fact, one such UI change is in preview as of yesterday, so expect any Dom browsing you write like this to break in a few months when those changes go GA.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Microsoft Dataverse

#1
mmbr1606 Profile Picture

mmbr1606 22 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 17

#3
ankit_singhal Profile Picture

ankit_singhal 11 Super User 2025 Season 1

Overall leaderboard

Featured topics