Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Unable to call gs.getProperty() in UI action

soumyadaggula
Tera Contributor

Hello Team , 

I want to restrict the UI action to few catalog items , for which I have created a sys property and I am referencing the sys property in UI action , but that does not seams to work , cloud you please help me where am I going wrong 
Here is what I have used 


soumyadaggula_0-1713530510086.png

 

1 ACCEPTED SOLUTION

Hi @soumyadaggula,

 

If it's a comma-separated list, try the following script:

current.assigned_to == gs.getUserID() && gs.getUser().isMemberOf(current.assignment_group) && gs.getProperty('sc.task.create').contains(current.request_item.cat_item)

View solution in original post

7 REPLIES 7

Community Alums
Not applicable

Hi @soumyadaggula ,

Can you please try like this 

gs.getProperty('sc.task.create').indexOf(current.request_item.cat_item)

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak

Hello @Community Alums 
I tried 

current.assigned_to == gs.getUserID()&&gs.getUser().isMemberOf(current.assignment_group)&&gs.getProperty('sc.task.create').indexOf(current.request_item.cat_item)

 

still does not seam to work 

Community Alums
Not applicable

Hi @soumyadaggula ,

Can you please check that the value in your system property i.e., sc.task.create contains the value of current.request_item.cat_item. 

Can you please try like that once. May be this will work.

if(gs.getProperty('sc.task.create').indexOf(current.request_item.cat_item)>= 1)

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak

James Chun
Kilo Patron

Hi @soumyadaggula,

 

What value does the property 'sc.task.create' store?

I am assuming it's a single sys_id of a catalog item?

 

Cheers