We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Unable to fetch values from API SNC.UserCriteriaLoader.getAllUserCriteria(userId) in service portal widget

Raskill1
Giga Contributor

Hi Experts,

 

I am not getting any value from the API SNC.UserCriteriaLoader.getAllUserCriteria(userId) when added to the script of my widget (in the global scope). Although this works fine when I run it in the scripts - background. Any help with this is greatly appreciated.

 

Thanks,

Raskill

1 REPLY 1

SatheeshKumar
Kilo Sage
var result = new sn_uc.UserCriteriaLoader.getAllUserCriteria('62826bf03710200044e0bfc8bcbe5df1');
gs.log(result);

 

you need to pass the user sys_id as a parameter. verify your userId varaible has correct sys_id value.