keep getting null returned on this line:
var getFieldControl = window.parent.document.getElementById("aet_documents");
//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:
Thanks for any insight!
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.
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.
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.
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.