- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2015 04:13 AM
Dear Friends,
I don't want to allow a normal user to create a P1/P2 ticket. Priority is calculated by "Impact" and "Urgency" fields. How can i hide Impact = 1 and Urgency =1 so that a P1/P2 ticket cant be created?
We have one field "Contact Type" with choices 'Self service', 'Alert' and 'Supplier'. We want to block P1/P2 ticket for Contact type = 'Supplier' (Normal user).
I created a UI Policy(onLoad) and added condition "Contact type" is "Supplier" and then added below code:
Execute If true:
function onCondition() {
g_form.removeOption("impact", "1");
g_form.removeOption("urgency", "1");
}
Execute If false:
function onCondition() {
g_form.addOption("impact", "1", "1 - High", 1);
g_form.addOption("urgency", "1", "1 - High", 1);
}
This is not working fine because if i create a ticket with contact type "event" and then save it and then open this ticket then in Impact choice list i see 1 choice two times which is executing because false condition is adding it again. So it is better to hide this choice option instead of add/remove. Please help.
thanks
Ramandeep
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2015 04:29 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2015 04:19 AM
disableOption();
function disableOption()
{
var fieldName = 'u_status';
var control = g_form.getControl(fieldName);
if (control && !control.options)
{
var name = 'sys_select.' + this.tableName + '.' + fieldName;
control = gel(name);
}
if (!control)
return;
if (!control.options)
return;
var options = control.options;
for (var i = 1; i < options.length; i++)
{
var option = options[i];
alert('hello'+ options[i].value);
if(g_user.hasRole('itil') && (options[i].value == "Draft" || options[i].value == 'Review' ||options[i].value == 'Closed'))
{
// Here im making readonly "Draft, Review, Closed' choices
control.options[i].disabled = 'true';
}
}
}
If you want to hide means replace below code
control.options[i].style.display= 'block';
control.options[i].disabled = 'true';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2015 05:13 AM
Hi Harish,
Thank you for your inputs! I will check and will share the findings.
Ramandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2015 04:29 AM
Hi Raman,
check the below thread,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2015 05:03 AM
Hi Raman,
Try this.
Condition : Contact type is "Supplier"
Reverse If False is true
Execute If true:
function onCondition() {
g_form.removeOption("impact", "1");
g_form.removeOption("urgency", "1");
}
Execute If false:
function onCondition() {
}