Can I Call a catalog item from within another catalog item?

psenkow1
Giga Contributor

We have a catalog item to request access to jump servers.   As part of this, the requester needs to also tell them if they need access to a database(s) and what those are.

We have another catalog item that is to request access just to 2 specific databases.   These two databases require special work to be done (special approvals, etc.).

I would like to change the request for access to Jump Servers, such that IF they also request access to one of these 2 special databases, then it calls the catalog item for databases, and collects the information from that catalog item; adds it to Jump Server request, and puts all the information then into the request ticket.   I would rather not have to duplicate the variables on the database request, into the jump server request.

The reason for this is, if there is ever a change to the database request, we will only need to make the change in one place. Since the jump server request is calling the database request, the changes would be automatic in the jump server request.

Can anyone tell me if this is possible, and how to do it?

Your help is really appreciated.

1 ACCEPTED SOLUTION
16 REPLIES 16

Hi Rhonda,



Theoretically - yes. You could create a single catalog item that launches several others using the Cart scripting API. The first catalog item with it's associated RITM and REQ would not be of much use. Your script would have to copy over the information to the new records.



Service catalog script API


Thanks Chuck,


Yes, I was looking at the service catalog script API.   Where/How would I call it?   The doc talks about using Business Rules, but where in the initial catalog item would I put this script in order to add the other catalog items to the cart?


I would try creating an after insert BR on the sc_request record. Oddly enough, it gets created after the child sc_req_item record, so if you wait until you have the sc_request record, you'll have all the details of the request (like requested_for) as well as the details on sc_req_item. You can then translate that in to a new request using the Cart API.



Another thought would be to create additional child sc_req_item records on the existing sc_request, but that might get confusing with duplicate information and trying to resolve all the variables. Not sure I would try that first. It sounds like a cleaner end game, but harder to build and maintain.


Thanks Chuck!   I'll give it a try and mark correct if I can get it to work.   🙂


wiltonr
Giga Contributor

Making progress!  



I created the BR after insert on the sc_req_item table; I first tried on the sc_request table and had an infinite loop going because every time it created the new RITM it also created a new Request which triggered the BR.   Oops!



So I changed it to after insert of the RITM where the condition is that the ritm.cat_item is a specific catalog item, and then I'm doing a glide record query to the Variable Ownerships table to get the values from the current RITM that I need to pass to the other catalog item.   I don't have it fully working but I think I might be able to get there.



The one thing I don't like is that it creates the new RITM under a separate/new Request.   I'd prefer that any additional catalog items I create all be created under the same Request.   Any ideas?



Thanks,


Rhonda