How to replace DOM manipulation technique from client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2018 05:27 AM
Hi,
Anyone have any idea about replacing DOM manipulation form script. Actually while reviewing code, servicenow asked us to replace DOM manipulation form few script. But I couldn't find any way to replace it. Can anyone aware of it.Please help.
This is Onchange client script.
if(newValue=="rejected_solution" || newValue=="proposed_solution"){
var items1 = $$('BUTTON').each(function(item){ ///// How to replace this line and call the button
//if(item.innerHTML.indexOf('Reopen Incident') > -1){
//item.hide();
//}
if(item.innerHTML.indexOf('Resolve Incident') > -1){
item.hide();
throw $break; //Exit after hiding the first 'Resolve Incident' button
}
The above highlighted line is the problem here. How to replace that line form script and modify the code. Anyone have any idea?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2018 05:54 AM
the only way is by using server side script. you can define the condition in your ui action this way you can avoid DOM Manipulation .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2018 05:57 AM
See if you like this technique: Styling UI Action Buttons
I store all of my UI Action properties in one section on the page. This serves as an on page load style sheet.
Chris
