Hiding a value from a reference field

ramak
Giga Expert

Is there a way of hiding a group name from "Assignment group" field on the Change form till the New Change reached "Scheduled" status ?

Reason for this is there is a group which only needs to be selected after all the approvals are done. This group in turn bridges with a 3rd party tool & selecting this group before the change is approved, would prematurely bridge the change request.

I know you can do this on a choice list but not sure on how to hide a value in a reference field.

Any input would help me here !!

1 ACCEPTED SOLUTION

Hi Suhas,



  1. No, you don't have to use a script include.   For an advanced refqual, you can specify "javascript:" with any valid javascript statments following it, including a call to a script include.   But you can also just insert your statements right there in the advanced refqual.   The advantage to calling a SI is that you could call a much more complex script... the refqual field does have a finite length which limits the amount of code you can enter there.
  2. If you want to list the 9 groups (out of 10) all the time, and include the 10th group when state=scheduled, use the second refqual I gave you (replace the group name and the state value with whatever you need):

            javascript:current.state==-15 ? "active=true":"active=true^name!=Infrastructure NSW";


One important thing to note, I see in your query you were using "nameNOTInfrastructure NSW", which I don't think is a valid query... which would explain why you are still seeing all of the groups.   An invalid query condition is ignored and all records are returned.



Instead you should be using "name!=Infrastructure NSW".




Try that and see how it works for you.




Thanks,


-Brian


View solution in original post

23 REPLIES 23

Hi Suhas,



You can also write this without the function, just as an advanced qualifier:



                  javascript:current.state==-15 ? "active=true^name=Infrastructure NSW":"active=true^name!=Infrastructure NSW";



If the state is (-15), do you want to ONLY show this one group?   If you want to show the others as well, change this to:



                  javascript:current.state==-15 ? "active=true":"active=true^name!=Infrastructure NSW";





Thanks,


-Brian


Thanks Brian...I am yet to use your advanced qualifier. But before I use, isn't a script include necessary here ?



Let's take for ex, there are 10 groups. I want 9 groups in the assignment group lookup before reaching 'scheduled' state & all the 10 groups once it reached 'scheduled' state.



Hope this helps !!


Hi Suhas,



  1. No, you don't have to use a script include.   For an advanced refqual, you can specify "javascript:" with any valid javascript statments following it, including a call to a script include.   But you can also just insert your statements right there in the advanced refqual.   The advantage to calling a SI is that you could call a much more complex script... the refqual field does have a finite length which limits the amount of code you can enter there.
  2. If you want to list the 9 groups (out of 10) all the time, and include the 10th group when state=scheduled, use the second refqual I gave you (replace the group name and the state value with whatever you need):

            javascript:current.state==-15 ? "active=true":"active=true^name!=Infrastructure NSW";


One important thing to note, I see in your query you were using "nameNOTInfrastructure NSW", which I don't think is a valid query... which would explain why you are still seeing all of the groups.   An invalid query condition is ignored and all records are returned.



Instead you should be using "name!=Infrastructure NSW".




Try that and see how it works for you.




Thanks,


-Brian


Great, the one line ref qual is working like a charm.



For the script include, one small issue is once the change reaches 'scheduled' only Infrastructure NSW is visible. Nonetheless I would be using the advanced ref qual method.



Thanks very much !!


Hi Suhas,



You were getting that (just the one) with the Script Include because you specified "nameISInfrastructure NSW"   or   "name=Infrastructure NSW" when the condition matched... what you actually want to do there is just not specify any additional filter, so that you get all of them.




-Brian