Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

create service catalog item via script

philbool
Giga Expert

I have inherited a large catalog with about 400 requestable catalog items with workflows and variables.   I come from a service management, rather than development background, so whilst my JS skills are growing fast, I am still struggling to put framework around new concepts and ideas and would be very grateful for your help.

All my catalog items have a product model associated with them that holds values that determine the approval processes required.   Please don't ask why these values are there rather than on the catalog item - this was an Itil / uniformity inspired senior management decision, not mine.

Anyway, as a result, all the data that I need to create a new requestable catalog item for a piece of software is in my software model table.   I would like to use a script to create a catalog item from a product model, and trigger this from a workflow on the software model table.   This script would run when a new software request has been completed.

I appreciate I need to use the run Script activity, but can anyone give me any advice on what kind of script would do this, and what it would look like?

1 ACCEPTED SOLUTION

No worries.   In your script, add this as the last line:


cat_item.insert();


View solution in original post

5 REPLIES 5

philbool
Giga Expert

That's done it!   Fantastic!   Thank you!



Just trying to work out how to mark your answer as Correct.