Need Condition for UI action to appear based on the choice list users

malaisamyj
Tera Contributor

Hi All,

I have an another requirement as below,

I have a choice list field where this field is referenced to 'sys_users' table. So that we can choose more than one user as per our requirement.

Based on this choice list field i have an UI action.

Condition for the UI action is

UI action should appear to the users who are all chosen in the choice list field.

So i have tried with the below conditions its not working. Can someone help   me?

current.cl_ownerLIKEjavescript;gs.getUserID();

Thanks,

Malaisamy

1 ACCEPTED SOLUTION

snehabinani26
Tera Guru

3 Using indexOf("searchString")

Use indexOf("searchString") to return the location of the string passed into the method if the glide list field, such as a Watch list, has at least one value in it. If the field is empty, it returns undefined. To avoid returning an undefined value, do any of the following:


  • Force the field to a string, such as: watch_list.toString().indexOf("searchString")
  • Check for an empty Glide list field with a condition before using indexOf(), such as: if (watch_list.nil() || watch_list.indexOf("searchString") == -1)

See if this helps.



http://wiki.servicenow.com/index.php?title=Referencing_a_Glide_List_from_a_Script#gsc.tab=0


View solution in original post

8 REPLIES 8

The ServiceNow Wiki content is no longer supported. Updated information about this topic is located here: Referencing a Glide List from a Script




Visit http://docs.servicenow.com for the latest product documentation


Stefan Baldhof1
Kilo Guru

Hi Malaisamy,



I think the previous answers already pointed you to the right direction.



Try the following as your UI Action condition:



        current.cl_owner.toString().indexOf(gs.getUserID()) > -1



Regards,


Stefan


Hi Stefan,



Its working fine.



Thanks


Malaisamy


HI,



If your question is answered , please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.




https://community.servicenow.com/docs/DOC-5601