- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2018 08:02 AM
Hi,
if User is has no location value then display none value , should not display any other Choice Values
Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === '') {
return;
}
var user=new GlideRecord('sys_user');
user.addQuery("sys_id", newValue);
user.query();
if(user.next())
{
alert(user.name);
var dep=new GlideRecord("cmn_location");
dep.addQuery("sys_id", user.location);
dep.query();
if(dep.next())
{
alert(dep.name);
var yy=dep.name;
g_form.setValue('comments',yy);
if(yy!='')
{
if(yy=='Americas')
{
g_form.clearOptions('category');
g_form.addOption('category','ktlo','KTLO');
}
if(yy != 'Americas')
{
g_form.clearOptions('category');
g_form.addOption('category','project_work','Project/Project Task');
g_form.addOption('category','task_work','Task work');
g_form.addOption('category','admin','Admin');
g_form.addOption('category','meeting','Meeting');
g_form.addOption('category','ooo','Out of office');
g_form.addOption('category','training','Training');
g_form.addOption('category','external_labor','External labor');
g_form.addOption('category','time_off','Time off');
g_form.addOption('category','appointment','Appointment');
g_form.addOption('category','call','Phone call');
}
if(isLoading && !g_form.isNewRecord()){
g_form.setValue('category', yy);
}
}
}
else
{
alert('location empty');
g_form.setValue('category', 'None');
}
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2018 02:08 PM
In the category variable/field, use choice as 'Dropdown with --None--'
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2018 05:28 AM
Hi ,
please explain .what is your exact requirements.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2018 10:03 PM
Hi chanikya,
You go to that page like in incident form category field and right click on that field and then select Configure dictionary then set the default value as --none-- . that value will show in category field as a default value .
and remove that inquiry value as Default value.
if it is help full for you please mark as like or helpful .