cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CallenAET
Advocate I
Advocate I

Re-Writing URL Field via JS

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!

 

 

 

4 REPLIES 4
cchannon
Super User
Super User

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.

ChrisPiasecki
Super User
Super User

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.

CallenAET
Advocate I
Advocate I

@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 

 

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.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (2,975)