
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 07:17 AM
Trying to write a Client Script (onLoad) for a table list view is not working. How can this be done?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 07:22 AM
Hi David,
onLoad client scripts only run when the form is loaded, not in a list. The only type of client script that applies to a list is onCellEdit.
http://wiki.servicenow.com/index.php?title=Client_Scripts

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 07:31 AM
btw... when you were walking down to enter that long line at the Harry Potter ride at Universal, I was the guy who interrupted your attention from you looking at your phone by saying, "Hey, Chuck". You briefly looked up and gave a smile. I was going to let you take my spot! lol

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 07:38 AM
Hi David,
Thanks for the memory at K17. I apologize if I seemed inattentive. I recall having several conversations on the phone at the same time with people who were trying to meetup. I wish I had a chance to meet and talk to everyone in person. I appreciate the thought of giving up your spot in line.
Regarding the list calculations and layout - I'd report it through HI as a bug or enhancement. If we're doing sums or averages, that implies numbers which are usually right justified. Seems like an oversight on my part.
I invite you to open an enhancement request! Our product managers DO listen.
Enhancement requests: Tell us how you would improve the ServiceNow product

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 07:40 AM
No worries Thanks for the advice!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 08:34 AM
(function() {
setTimeout(function(){
var aTags_ = document.getElementsByTagName('a');
for (var iA = 0; iA < aTags_.length; iA++)
{
if (aTags_[iA].href && aTags_[iA].href.indexOf('https://myDomain.service-now.com/time_card.do?sys_id=') == 0)
{
var glide_fields = document.getElementsByTagName('th');
for (var iG = 0; iG < glide_fields.length; iG++)
{
if (glide_fields[iG].getAttribute('glide_field'))
{
if ((
glide_fields[iG].getAttribute('glide_field') == 'time_card.total' ||
glide_fields[iG].getAttribute('glide_field') == 'time_card.sunday' ||
glide_fields[iG].getAttribute('glide_field') == 'time_card.monday' ||
glide_fields[iG].getAttribute('glide_field') == 'time_card.tuesday' ||
glide_fields[iG].getAttribute('glide_field') == 'time_card.wednesday' ||
glide_fields[iG].getAttribute('glide_field') == 'time_card.thursday' ||
glide_fields[iG].getAttribute('glide_field') == 'time_card.friday' ||
glide_fields[iG].getAttribute('glide_field') == 'time_card.saturday'
) && glide_fields[iG].classList.contains('text-align-left'))
{
glide_fields[iG].classList.remove('text-align-left');
glide_fields[iG].classList.add('text-align-right');
}
}
}
break;
}
}
}, 2000);
})();
Bam. Very little overhead.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 08:50 AM
If it works... Thanks for sharing.
Hopefully the DOM doesn't change.