Update all the catalog items with new User Criteria

dev_K
Tera Contributor

Hi All,

 

Is there a way to add additional user criteria to all the catalog items? I find it that modifying this property for +400 catalog items would be to mundane. Any way to do it faster all at once?

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

HI @dev_K 

 

There is no related list (M2M) which can be used to update all item in one go. You need to do manual way only. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Sandeep Rajput
Tera Patron
Tera Patron

@dev_K You can write a fix/background script to update the user criteria on the desired catalog items by making entries in sc_cat_item_user_criteria_mtom table. 

Ankur Bawiskar
Tera Patron
Tera Patron

@dev_K 

you can use background script for this and handle it

Something like this

var catItemSysId = 'sysId1,sysId2'; // give the 400 sysIds here as comma separated values
var arr = catItemSysId.split(',');
var userCriteriaSysId = ''; // give the sysId of the User Criteria here

for (var i in arr) {
    var rec = new GlideRecord('sc_cat_item_user_criteria_mtom');
    rec.initialize();
    rec.sc_cat_item = arr[i];
    rec.user_criteria = userCriteriaSysId;
    rec.insert();
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@dev_K 

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

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