Siddhant
Tera Expert

 Everytime you want a new item to be added to your catalog, you need to configure the catalog item form (Maintain items module) and then add variables/variable sets to the item.

While I was working on my mini project (Car Rental Agency) I came across a simple solution to automate this process. I had a list of vehicles to be added to the catalog. & adding each vehicle individually would have been a tedious task, so i decided to automate the process.

 

  • Step 1 -  Create a table : Vehicle(item) Info, and load the list of vehicles(items) into it using import sets.                          If you are unaware of importing data into tables please refer the link below -                   Importing Data into Servicenow

 

  • Step 2 -  Create a Flow ; choose the trigger as Created or Updated, select the table that you created in step1.

So, basically what are we gonna do is for every record inserted into the table created in step1, we create a record in Catalog Item (sc_cat_item) table.

This is how the entire flow will look like -

find_real_file.png

 

  • Step 3 - Select Action - Create or Update record , select table - sc_cat_item, populate the fields according to     the trigger record (use data pill picker). Here's an example -

find_real_file.png

You would have noticed i skipped the 1 Action from the entire flow design. But this step is the best to explain it.

So, while creating a new sc_cat_item record we need to populate the category and catalog field. So in order to dynamically select the category based on a type field in my table I have created that action. You can do as per your needs. Make sure you provide a valid value to these fields (Catalogs & Category) otherwise your added item will not be displayed on the catalog. 

Action 1 example -find_real_file.png

I have a field in the trigger record - fieldname: 'type';value: 'SUV', with its counterpart being a Category with the title SUV. I have other values & titles as well; cruiser,sports,hatchback,sedan to name a few. In this way i am able to categorize the vehicles according to their type. You can decide for yourself which field to create in order to segregate your items or may be do some other things.

 

  • Step4 - Select Action - Create record , select table - io_set_item.

Catalog item gets added to the catlog but now we need to add variables to the item as well in order to interact with the user. Instead create Variable sets according to your requirements. I have created Travel Details & User Info to get the details regarding the travel as it is a Car rental app. You can choose appropriately.

Now, we don't need to create a seperate varibale set for each catalog item. Just link the set to the item. For this in the baseline system we have a table named Catalog Variable Set (io_set_item). This table maintains records of link between a catalog item & its variable sets.

Select, field - name: Catalog item, value: refer to the catalog item record created inthe step3;

            variable set: choose the variable set;

            order: this one is optional. If you are going to add more than one 1 variable sets then set this val.

find_real_file.png

 

  •  You are done with the automation flow! If you want to add more variable sets to the same item, repeat the step4 and add the desired variable set to the catalog item.

 

Notes - Make sure while creating the sc_cat_item record you populate the Catalogs & Category fields with appropriate values. Otherwise a record will be inserted but due to empty values in these fields the item will not be displayed into the catalog.

*Imp -    Make sure you have role to add records to the sc_cat_item & io_set_item table.

Also the tables are configured to create & update data.

If you're going to design the flow in a different scope, grant permissions to write to & config these tables before you     begin!

 

 Hope you find this helpful!

Please provide any suggestions, if any.

For any assistance please feel free to ask or post a question in the now community.

Thank you!

Version history
Last update:
‎06-29-2021 12:11 AM
Updated by: