Create Multiple RITMs Under Same REQ Using the UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2024 06:25 AM
Hi All,
I have a UI Action that runs on the alm_hardware table. When assets are selected and the button is clicked, it submits the RITMs based on the number of assets selected, with each RITM associated with the REQ. Below is the script used to achieve this:
var configId = current.ci.sys_id;
var cartId = GlideGuid.generate(null);
var wasteCart = new Cart(cartId);
var item = wasteCart.addItem('bc94067c978516144c913b6e6253af41', 1);
wasteCart.setVariable(item, "u_item_ewaste", configId);
wasteCart.setVariable(item, "u_previous_state", current.install_status);
var rc = wasteCart.placeOrder();
var ritm = new GlideRecord('sc_req_item');
ritm.addEncodedQuery('cat_item=bc94067c978516144c913b6e6253af41^sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()^variables.7cbe614b97091a104c913b6e6253af81=' + configId);
ritm.orderByDesc("created");
ritm.query();
if (ritm.next()) {
current.install_status = 500;
current.update();
} else {
gs.log("RITM not created hence status is not changed for serial number: " + current.serial_number, 'eWaste Logs');
}
Now, I have a requirement: when the user selects 10 assets in the table and clicks the button, it should create 10 RITMs under a single REQ. Please let me know how this can be achieved.
Regards,
Priya
- Labels:
-
Asset Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2024 01:31 PM
Hello Priya,
Please follow below steps,
1. Navigator -> alm_hardware.LIST
2. Right click on any of the table column -> Configure > UI Actions
3. Enter the name. Tick the check box Client and List Banner Button
4. onClick: getIncidentsList()
5. Inside the Script,
alert will display the list of sys_id's of selected records.
Please mark helpful, if my code resolved your issue.
BR,
Suman.
