Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to publish multiple software models to catalogs

MercBuilding
Tera Guru

Hi,

   We are publishing software models to catalog to make it available for end user to request, BUT its getting hard to open each model and publish it. Is there any way we can publish 50+ models at once?

 

Thanks!

11 REPLIES 11

@MercBuilding There is no such functionality i believe and are you trying to copy the oob publish to catalog item UI action through your script?

 

new ProductCatalogUtils().createProductCatalog(gr,sc_category,type,catalog);

 

I this code can you check if the scope of your script and this script include is same? Otherwise you will have to add the scope name before the SI name.

Hi @Raghav Sharma24 ,

    Yes iam trying to publish the software models using this script for 100+ models but this is not working. The script include and fix script are in same scope.

Thanks!

@MercBuilding Here is the working code (tried in PDI) , there were few issues in your code.

 

publishSoftwareModel();

function publishSoftwareModel() {
    var sc_category = '2809952237b1300054b6a3549dbe5dd4'; //the catalog category sys_id
    var type = 'model';
   
    var mod = new GlideRecord('cmdb_model');
    mod.addEncodedQuery('product_catalog_item=NULL');
    mod.setLimit(10);
    mod.query();
    while (mod.next()) {
        mod.product_catalog_item = new ProductCatalogUtils().createProductCatalog(mod, sc_category, type, 'pc_software_cat_item');
        mod.update();
    }

}


Please mark the answer correct/helpful accordingly.

@MercBuilding did you try this?

@MercBuilding were to able to get this working?