How to show devices given to user through one catalog item in another catalog item

Servicenow use1
Tera Contributor

Hi , 

we have a catalog item (first RITM) that collects the info of devices (laptops and peripherals) for the new user. When the user is not joining, then there is a new catalog item (second RITM) which needs to collect all the devices provided in the previous request. How to show all the devices tagged to the person from first RITM in the second RITM

 

 

 

 

1 ACCEPTED SOLUTION

Hi,

I believe "devices_to_be_returned" is referring to model table

update as this

var getMyDevices = Class.create();
getMyDevices.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    getDevices: function() {
        var user = this.getParameter('sysparm_user');
        var arr = [];
        var gr = new GlideRecord("sc_req_item");
        gr.addQuery("cat_item.name", "RITM 1"); // name of your catalog item
        gr.query();
        while (gr.next()) {
            if (gr.variables.requested_on_behalf_of == user)
                arr.push(gr.variables.model.sys_id.toString());
        }
        return arr.toString();

    },


    type: 'getMyDevices'
});

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Uncle Rob
Kilo Patron

When you say "collects info of devices", where is it stored?

Hi,

Ideally as per the flow created by previous developers , these should be stored in alm_hardware table. But I couldn't find any of these in alm_hardware table not sure why, probably flow must be discontinued somewhere.

currently what I am doing is that:

RITM -1

user submits requests by selecting Requested for and Model (referring to hardware model table)

RITM-2

there are two fields- Requested for  and Devices to be returned

when requested for is selected then all the devices which are requested by him using RITM1 should be populated in Devices to be returned field. 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

I shared solution for something similar and it has worked for the member

check that and enhance as per your requirement

Populate all RITM numbers of selected user in catalog item.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,

Instead of showing RITMs on the user name, How can I show all the devices which he ordered using the "RITM-1" in a list collector field.?

In the above solution you have given this "arr.push(gr.getValue('number'));"

can I do something here like "arr.push(gr.variables.getValue('devices_ordered'))

Can you please let me know how to get info like this from variable of another RITM?