- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2020 08:55 AM
Hello Experts
I'm facing an issue with an UI Policy (with Run Script enabled) which is supposed to Show/Hide fields and Form Annotations on Workspace. It works perfectly on Platform UI, but it does not work as expected on the workspace. Below is the code snippet used in the script section.
I read some posts which says some of the `g_form` API's are not supported on the Workspace, but not seen any ServiceNow KB article which confirms it.
Application: Custom/Scoped Application (Created 'glide.script.block.client.globals' property with respect to scope and set had set the value to 'false').
Version:Orlando Patch 4
Module: CSM Agent Workspace.
I would appreciate any insights on the issue and for any alternate solutions.
Thank you
Dinesh
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2020 09:01 AM
Not sure the $('ap').up().show() and $('ap').up().hide() is supported. Did you try checking the browser console for errors?
You can press ctrl + shift + i and click on console:
If there are any errors after running the script, that might help us further.
Also I do not see setDisplay in the supported API's:
Maybe you can change it to:
setVisible(fieldName, isVisible)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2020 09:01 AM
Not sure the $('ap').up().show() and $('ap').up().hide() is supported. Did you try checking the browser console for errors?
You can press ctrl + shift + i and click on console:
If there are any errors after running the script, that might help us further.
Also I do not see setDisplay in the supported API's:
Maybe you can change it to:
setVisible(fieldName, isVisible)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2020 09:33 AM
Hello Willem
Thanks for your insights. Yes I see the '$' is not supported on the Mobile/Workspace view. I see an error in the console.
What would be the alternative for this to work on Mobile platform? Also, I have replaced the setDisplay(); with setVisible(); it doesn't work either.
Thank you
Dinesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2020 09:37 AM
What is $('ap').up().show() and $('ap').up().hide() used for? Can you comment $('ap').up().show() and $('ap').up().hide() out and see id the setVisible works?
Also, please mark answers helpful if you think the help is helpful. It will help the community a lot! 😄
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2020 10:59 AM
Hey Willem
$(ap).up().hide() and $(ap).up().show() // Here 'ap' is the element id of annotation
The above are used to hide/show form annotations. The form layout also has some annotations, which has to be hidden when certain conditions are met. Annotations were hidden on Platform UI with that line of code, but it doesn't hide them on Workspace view.
Also, I commented out '$(ap).up().show()' and '$(ap).up().hide(') from the code and can now see that 'setVisible()' works great.
With that being said, I need to hide the Form Annotations as part of the use case. Any insights to hide the annotations on workspace/mobile view?
Thanks for your assistance so far.
Dinesh.