How to hide/unhide a choice list value(not add/remove)

ramandeep
Kilo Contributor

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

1 ACCEPTED SOLUTION
7 REPLIES 7

Hi Naveen,



If i use this and then from the drop down when contact type is changed from "Supplier" to let us say "self Service" then impact and urgency 1 does not appear again.



Reverse if false is true only.



Thank you.


Hi Alex,



Thank you for your inputs! I will check and will share the findings.



Ramandeep


Dear Alex,



It worked fine. Thank you for all the help! I appreciate that.


@Harish: I thank you for the help! "control.options[i].style.display= 'block';" fulfill the purpose in Chrome but not in IE. I appreciate your help as well.




Thanks


Ramandeep