Hide field (element) by sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2017 08:15 AM
Has anyone tried (and hopefully succeeded) in hiding a form element by sys_id? The standard way to hide a form field is:
setDisplay(fieldName, boolean)
But what if I just wanted to identify the field by sys_id '11e7374a4f37f6041fee7fe24210c737'
I am really trying to hide specific annotation fields and embedded lists...ctomasi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2017 11:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2017 05:04 AM
Hello Anurag,
This is extremely important to our project and I am still having an issue. We have multiple annotations and I need to hid them individually. I tried assigning an "id" as some other posts have mentioned, but no luck there. I would really appreciate any help you can offer? Maybe you can send a screenshot of what you did? Again, I have to hide more than one, so definitely need a way to identify them individually.
Many thanks!
Neal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2017 06:12 AM
I didn't find time to try the individual one mate, ill try to see if i can do something today
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2017 06:19 AM
Hi Anurag,
I actually just figured it out...
<div id=XXX>Annotation Label</div>
if(condition){
XXX.style.display = 'none';
}
On a semi related note...
Any chance you know how to hide an embedded list? I tried to use the SN Guru method https://www.servicenowguru.com/scripting/client-scripts-scripting/hiding-related-lists-embedded-list...
but I think SN deprecated hasClassName
We are on Istanbul...
I tried
var list = ('div[tab_caption="Soil Sample"]')[0];
if(list.hasClassName('list_embedded'))
{
list.hide();
}
SN Guru uses $$ but i just get errors that $$ is not a function
I got error without $ or $$
onChange script error: TypeError: list.hasClassName is not a function function (){var o=i(m,arguments);return l.apply(n,o)}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2017 06:32 AM
Hi Neal,
Can you try this
var list = ('div[tab_caption="Soil Sample"]')[0];
if(list.hasClassName('embedded'))
{
list.hide();
}