Filter condition for a module with javascript?

regizzle
Kilo Contributor

So, i know its very possible to use a javascript: bit of code within a filter however, I am facing an issue.

I am trying to use:

javascript:gs.getUserID().getRecord().getValue('u_site')

Where u_site is a reference to core_company.

so its: Site is javascript:gs.getUserID().getRecord().getValue('u_site')

However, when i go and actually click the module it returns (empty), yet, when I do a test via business rule returning a gs.addInfoMessage, it returns the sys id properly.


Where am i going wrong?


Thanks,

Roland

1 ACCEPTED SOLUTION

try running a cache.do (during non peak hours or when its a good time for the instance to possibly be down for a few minutes)


View solution in original post

13 REPLIES 13

manikorada
ServiceNow Employee
ServiceNow Employee

Roland,



Try something like this:


1) Have a script include like:


Name : getMyFilter()


Client Callable : true


Script:


return gs.getUserID().getRecord().getValue('u_site');



2) Have the filter as javascript:getMyFilter()


Hey Mani,



It gives me an Invalid Return.



I'm pretty sure my script is incomplete if all I put is :


return gs.getUserID().getRecord().getValue('u_site');






ahaz86
Mega Guru

did you try:


gs.getUser().getRecord().getValue('u_site')


regizzle
Kilo Contributor

I did, no marbles.