The CreatorCon Call for Content is officially open! Get started here.

Why Script Include not working?

Ankita Kolhe
Tera Contributor

Hi Community,

I created a Script include which returns if the user has exactly the given role.

find_real_file.png

Calling this script include from List Control Omit Condition but it's not working while refershing the Release List.

find_real_file.png

Thanks,

Ankita

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Ankita Kolhe 

Hi,

You are using the wrong method and wrong lines; I correct them

1) it should be getRoles()

2) it should be split(',')

var au = new ArrayUtil();
var roles = gs.getSession().getRoles() + '';
var roleArray = roles.split(",");
var isRolePresent = au.contains(roleArray, role);
return isRolePresent;

In the Omit new condition script remember to initialize answer as false

line 5 should be

var answer = false;

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

13 REPLIES 13

Uncheck the "Omit new button" checkbox and see if its working now.

Please mark helpful/correct if it helped resolve your query.

Thanks,
Saji

Hi Sajilal,

Thanks.It's working.

But I have a question:-

What's the use of then Omit new button checkbox.As I know If Omit new button is checked ,it checks for the condition to be true or false. 

@Ankita Kolhe 

Glad to know that my approach worked.

Why are you testing with admin? admin will have all the roles.

Please test with actual role users

Please mark my response as correct and close the thread.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankita Kolhe 

Would you mind closing this question by marking appropriate my response as correct as my response worked for you?

This would help future members.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader