Looking for solution for multiple RITMs from same Catalog Item

wiltonr
Giga Contributor

I am looking for a solution to a complex problem and hoping someone can help.

We have a catalog item that allows an end user to request access to multiple groups for multiple users (both variables are list collectors).  We currently have this functionality in a custom app and we are trying to get everything convered into the Service Catalog/Service Portal.

To replicate the behavior of the custom app, we need to have on RITM for each user for each group (so that there is an approval process for every user/group combination).  The approvers are dependent upon the group so there are different approvers for each group and we need to allow approvers to approve Person A but reject Person B, etc.  

For example, the end user can request to have three users added to two groups.  We would want to have 6 RITM's created with approvals, but we need to get all of the variables from the catalog item to be available on the RITM's so the approvers have access to them.

Does anyone have a solution for this?

Thanks,
Rhonda

 

 

 

1 ACCEPTED SOLUTION

ccajohnson
Kilo Sage

My developer instance is currently under maintenance and I cannot prove what I have. I am including some code I used from another project which will generate multiple requests based off of a CI list variable. You can modify your code so that it will use the proper variables for your project:

    generateHwRefreshItem: function(itmObj) {
        var array1 =[];
        array1 = itmObj.variables.hw_refresh_ci_selection.toString();
        var array2 = [];
        array2 = array1.split(',');
        var Length = array2.length;

        for(var i=0; i<Length; i++) {
            // add item to existing request  
            var reqHelper = new global.GlideappCalculationHelper();
            reqHelper.addItemToExistingRequest(itmObj.request, 'be474f023772b240ee341aa543990e69', 1); // 1 is the qty  
            reqHelper.rebalanceRequest(itmObj.request);

            // update/add values to variables on item
            var grReqItem = new GlideRecord('sc_req_item');
            grReqItem.addQuery('request', itmObj.request);
            grReqItem.addQuery('cat_item','be474f023772b240ee341aa543990e69');
            grReqItem.addNullQuery('configuration_item');
            grReqItem.query();
            if(grReqItem.next()) {
                grReqItem.variables.hw_refresh_requested_for = itmObj.variables.hw_refresh_requested_for;
                grReqItem.variables.hw_refresh_cost_center = itmObj.variables.hw_refresh_cost_center;
                grReqItem.variables.hw_refresh_hw_model = itmObj.variables.hw_refresh_hw_model;
                grReqItem.variables.hw_refresh_ci_selection = itmObj.variables.hw_refresh_ci_selection;
                grReqItem.variables.hw_refresh_short_description = itmObj.variables.hw_refresh_short_description;
                grReqItem.parent = itmObj.sys_id;
                grReqItem.configuration_item = array2[i];
                grReqItem.update();
            }
        }
    },

View solution in original post

22 REPLIES 22

monika223115
Kilo Contributor

Hi,

I have a similar requirement. Can you please help me to understand the role of Parent workflow and Child workflow for this requirement. Also, what role does the timer plays? I just used the above mentioned script in my workflow for the catalog item under the run script, and it runs an infinite loop of RITM. ARe there supposed to have a parent and child RITM. Can you please explain where to use this code 

monika223115
Kilo Contributor

Hi @ccajohnson  ,

 

I see your solution has been marked helpful. I have a similar requirement where I will be selecting groups in a list collector. On the basis of Group's Managers for the groups selected, I need to create multiple RITMs. Can you please help me with the logic as you have already implemented something similar.

I created a run script in my catalog item's workflow and ran the script mentioned by you. It is creating an infinite loop of RITMs. Also, I observed that you have mentioned a child workflow also. Can you please explain the purpose of the Child RITM as well.

 

Thanks in advance

Regards,

Monika

Rather than adding to this thread which has specific needs that are worked through, I would suggest creating a new post. That way we can get a full understanding of what you have built and what you are expecting to accomplish. Since this thread is over 2 years old, there may be other solutions out there that others may be able to help with as well.