We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Is GlideDocument an alternate by servicenow for using client-side DOM manipulation?

JerryJ071847183
Tera Sage

Hello community members,

 

I came across support article which talks about  "Client-side code should not use DOM manipulation technique"

 

in the resolution it is mentioned lookout for GlideForm api or other methods to fix this.

 

So in documentation i found this api with respect to DOM 

GlideDocument 

 

My query is, has anyone used GlideDocument in their project in place of DOM , and is it able to simulate same behaviour like DOM. PLease share your experinence if you have used it.

 

 

1 ACCEPTED SOLUTION

Robbie
Kilo Patron

Hi @JerryJ071847183,

 

Confirmation that DOM manipulation is against best practice and likely to lead to future issues.

Depending on what you're trying to achieve you have a few options of which GlideDocument is one as well as getFormElement()

 

Here's an example where for one partcilar customer I was asked to hide the < (Back button)

document.getElementsByClassName("btn btn-default icon-chevron-left navbar-btn")[0].style.display="none"; // this is for the back button

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.


Thanks, Robbie

View solution in original post

1 REPLY 1

Robbie
Kilo Patron

Hi @JerryJ071847183,

 

Confirmation that DOM manipulation is against best practice and likely to lead to future issues.

Depending on what you're trying to achieve you have a few options of which GlideDocument is one as well as getFormElement()

 

Here's an example where for one partcilar customer I was asked to hide the < (Back button)

document.getElementsByClassName("btn btn-default icon-chevron-left navbar-btn")[0].style.display="none"; // this is for the back button

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.


Thanks, Robbie