REST API for user criteria validation -- catalog items

_navin9898
Tera Expert

Dear members,

Good Morning!

I am working on integration where I am receiving user's 'sys_id' and catalog item's 'sys_id' in request body. The requirement is evaluate user criteria for the user against the item received in request body and return 'true' & 'false' in response body. 

Could someone please let me know if any OOB API available for the same which can be utilised. 

I am aware of 'GlideappCatalogItem' API which can be used as 'GlideappCatalogItem.get('catalog item sys_id').canView(); however it works only for logged in user.

Many thanks.

Best Regards,

Naveen 

3 REPLIES 3

Anil Lande
Kilo Patron

Hi,

Please check below links, you can check user criteria by script.

https://developer.servicenow.com/dev.do#!/reference/api/rome/server/sn_uc-namespace/c_UserCriteriaSc...

https://community.servicenow.com/community?id=community_blog&sys_id=15df9936dbe001143dd13ca8f49619bb

https://community.servicenow.com/community?id=community_question&sys_id=34215be9dbdcdbc01dcaf3231f96...

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hi @Anil Lande ,

Thank you for your swift response. I have gone through provided articles but it didn't help much.

I have similar required as in below thread. I want to check access to a catalog item for a specific user.

https://community.servicenow.com/community?id=community_question&sys_id=ffeca1c51b59d950b3b911f8b04bcb77 

 

Best Regards,

Naveen

Hi,

The link you shared above is refers to this question only.

If you have user criteria applied on your catalog item then you can check it like below:

var userCriterias = ['6b6df061ff2121009b20ffffffffff44','0b5b0e6453631300afffddeeff7b1201'];
var userMatches = sn_uc.UserCriteriaLoader.userMatches(gs.getUserID(), userCriterias);
gs.info(userMatches);

In Above script replace sys_id of criteria and user sys_id who is making request.

It will not work as it is and you need to use above script as per your requirement.

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande