- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 07:04 AM
Hi,
i have a question regarding a field to be diplayed Mandatory only on a specific task.
I tried a simple ui policy but it forces display on the Item.
same if i check mandatory box!!
and also with a client script : g_form.setMandatory('variables.example', true);
Any idea how to do please?
thank you so much
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 08:41 AM
Hi,
Use this
function onLoad() {
//Type appropriate comment here, and begin script below
//task.u_task_name = "Build contract";
if(g_form.getValue('u_task_name')=="Build contract")
{
g_form.setMandatory('can_you_please_specify', true);
else{
g_form.setMandatory('can_you_please_specify', false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 08:25 AM
I tried this :
but it s not working, i think it s not good
function onLoad() {
//Type appropriate comment here, and begin script below
//task.u_task_name = "Build contract";
var task =new GlideRecord('sc_task');
task.addQuery('u_task_name', "Build contract");
task.query();
if(task.next())
{
g_form.setMandatory('can_you_please_specify', true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 08:41 AM
Hi,
Use this
function onLoad() {
//Type appropriate comment here, and begin script below
//task.u_task_name = "Build contract";
if(g_form.getValue('u_task_name')=="Build contract")
{
g_form.setMandatory('can_you_please_specify', true);
else{
g_form.setMandatory('can_you_please_specify', false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 02:03 PM
Hi Anurag,
it works !!
thank you so much.
function onLoad() {
//Type appropriate comment here, and begin script below
//task.u_task_name = "Build contract";
if(g_form.getValue('u_task_name')=="Build contract")
{
g_form.setMandatory('can_you_please_specify', true);
}
else{
g_form.setMandatory('can_you_please_specify', false);
g_form.setDisplay('can_you_please_specify', false);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 08:37 AM
Hi Nawal,
Create a UI Policy with the below condition to run only on catalog items and in the UI Policy Action select the variable and make the visible to false.
Create one more UI Policy with the below condition so that it will run only on task and in the UI Policy condition select the variable and make the mandatory to true.
Thanks
Sai Krishna
Kindly mark the answer as correct/helpful if it solves your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 02:05 PM
Hi,
thank you for this suggestion.