- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2015 10:12 AM
Details: Hi guys,
I have a UI policy set up and it is designed to hide a field on the incident form under the 'Closure Information' section at the bottom.
For some reason it does not work. I am dot walking to the 'parent' field within the 'Resolution Profile'. I have tested with all the fields in there and none work. However, if I change the condition to just 'Resolution Profile is any of the profiles' it works and makes the field visible. I have contacted ServiceNow and they say there is an issue with this on Eureka.
So I was wondering if there was a way to get around this by using a client script.
Ive tried to dot walk by using the onchange script below but I cant get it to work.
Ive set the field name to 'Resolution Profile'.
So essentially we want the 'Source' field to be visible and mandatory only when the parent field on the resolution profile is set to 'Actioned (with Incident)'
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var prof = g_form.getReference('u_resolution_profile');
if (prof.u_parent == 'Actioned (with Incident)')
g_form.setVisible("u_source", true);
g_form.setMandatory("u_source", true);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2015 03:20 AM
Thanks guys,
That sent me in the right direction.
Ive now got it fixed,
The below script works for onchange.
If ye need it to work for onload then another will need to be created as onload but for now the below does exactly what we need.
Thanks again
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var prof = g_form.getReference('u_resolution_profile');
if (prof.u_parent == 'eed0fd44a5780a405b2538fa703d4a79') {
g_form.setMandatory("u_source", true);
g_form.setDisplay('u_source', true);
g_form.setMandatory("u_root_cause", true);
g_form.setDisplay('u_root_cause', true);
} else {
g_form.setMandatory("u_source", false);
g_form.setDisplay('u_source', false);
g_form.setMandatory("u_root_cause", false);
g_form.setDisplay('u_root_cause', false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2015 03:20 AM
Thanks guys,
That sent me in the right direction.
Ive now got it fixed,
The below script works for onchange.
If ye need it to work for onload then another will need to be created as onload but for now the below does exactly what we need.
Thanks again
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var prof = g_form.getReference('u_resolution_profile');
if (prof.u_parent == 'eed0fd44a5780a405b2538fa703d4a79') {
g_form.setMandatory("u_source", true);
g_form.setDisplay('u_source', true);
g_form.setMandatory("u_root_cause", true);
g_form.setDisplay('u_root_cause', true);
} else {
g_form.setMandatory("u_source", false);
g_form.setDisplay('u_source', false);
g_form.setMandatory("u_root_cause", false);
g_form.setDisplay('u_root_cause', false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2015 04:45 AM
Hi Gerard,
To make this script work on onload, you dont have to create a new onLoad script. Instead you can define the same code as mentioned below.
function onChange(control, oldValue, newValue, isLoading, isTemplate)
{
if (|newValue == '')
{
return;
}
if(isLoading)
{
//place the code
}
This cut off the need of one onLoad client script.