- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2018 10:55 AM
I am trying to add a form annotation that displays only if certain field conditions are met. Can anyone point me in the right direction?
Solved! Go to Solution.
- Labels:
-
User Experience and Design

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2018 12:32 PM
Change your client script to run 'onChange' against the 'Business service' field. Then use the script below (adjusting the Business Criticality values to match yours as needed) and you should be good to go.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
// Get the 'Business service' reference
var bs = new GlideRecord('cmdb_ci_service');
bs.addQuery('sys_id', newValue);
bs.query(showBSAnnotation);
}
function showBSAnnotation(bs) {
if (bs.next()) {
// Show annotation if high business criticality.
if ((bs.busines_criticality == '1 - most critical') || (bs.busines_criticality == '2 - somewhat critical')) {
// Hide the annotation
$('my_annotation').up().show();
}
else {
// Hide the annotation
$('my_annotation').up().hide();
}
}
else {
// Hide the annotation
$('my_annotation').up().hide();
}
}
Please mark this response correct if I've answered your question. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2020 02:26 PM
I know this is an old thread, but the only way I got this to work in scoped application in the NewYork release is below. This will force the display of the single annotation even if they are toggled off.
1) form annotation:
<span id="anno1">whatever</span>
2) onload client script:
function onLoad() {
var row = document.getElementsByClassName("annotation-row");
row[0].style.display = 'block';
row[0].parentElement.style.display = 'block';
var wrapper = document.getElementsByClassName("annotation-wrapper");
wrapper[0].style.display = 'block';
wrapper[0].parentElement.style.display = 'block';
var anno1 = document.getElementById("anno1");
anno1.style.display = 'block';
anno1.parentElement.style.display = 'block';
}
Also, make sure you have system property ....glide.script.block.client.globals set to false.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2021 01:22 PM
Did you have to add glide.script.block.client.globals as a new system property for your scoped application?