Alternative to DOM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2017 03:52 AM
Hi All,
Currently I have a functionality where the number of attachments are suffixed next to the Paper Clip icon in any task record. This is done using a DOM manipulation in a onLoad client script as shown below.
var iconElement = document.getElementById('header_add_attachment');
iconElement.innerHTML = g_scratchpad.num; //This scratch pad value comes from an on display business rule
And this is how the icon looks
Is there any way to achieve this functionality apart from DOM? Please let me know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2017 04:32 AM
Hi Aswin,
Yes this is possible only through DOM. may be you can use gel() instead of document.getElementById. Internally gel is using the same thing.
One other way is using jquery library.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2017 04:35 AM
Can you provide some information about using jquery library (or) point to any documents about it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2017 04:47 AM
Hi Aswin,
For using jquery in servicenow you will have to create 2 ui scripts and copy paste the script from jquery libraries. But your requirement can be achieved using gel() so it's just that if you want to learn how to use jQuery in servicenow then you can try it in your demo instance and not in client instance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2017 10:47 AM
Hi Aswin,
I hope you were able to achieve your requirement? If yes then please mark the answer as correct, helpful and hit like. This helps in closing the thread for the question. Thanks in advance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader