Converting Catalog Items to Change Requests

C_Hick
Tera Contributor

I have a catalog item   - ADD Disk   - that is completely setup as a Catalog Task.   New request is to make the item a change request instead of a task.   Beyond changing the Catalog Task to Create Task and selecting CHG_REQuest in the workflow is there anything else needed?       Is there a better way to accomplish this?

3 REPLIES 3

amadosierra
Kilo Guru

Hi Cindy,



Create a Record Producer catalog item (Record Producer - ServiceNow Wiki). It is just like creating a regular Catalog Item but it allows you to select the target table (in your case Change Request) where the request will be created.


It is very straightforward, just make sure the variable names match the field names in the change request table. Upon the user submitting the request, a record in the target table will be created with no additional tasks or requested items.


C_Hick
Tera Contributor

That's the right way   but I already have a full catalog created with catalog items.   I am hoping   to be able to modify the workflow instead of recreating record producers for every item.


In that case, the other way of doing it is by including a Run Script activity to the workflow and include a script that creates the change request as follows:



var gr = new GlideRecord('change_request');


gr.initialize();


gr.setValue('short_description', current.variable_pool.short_description);


gr.setValue('description', current.variable_pool.description);


gr.setValue('comments', current.variable_pool.comments);


gr.setDisplayValue('cmdb_ci', current.variable_pool.cmdb_ci.getDisplayValue());


...


gr.insert();



Please note that current.variable_pool.short_description is the name of the variable in the catalog item.



Let me know if this helps you and if you have any questions.