I want to update an asset record after closing the catalog task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 06:28 AM
Hi,
My requirement is submit a request for laptop using Service catalog . A task will be created to deliver the Laptop. Fulfillment teams has to respond to the task .
I have added a asset variable on the catalog task to select the asset. fulfillment team will select the asset, dispatch it and close the task.
After task is close complete it should update the asset state in asset table. and map the ritm with the asset.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 07:23 AM
There is not an asset field out of the box on sc_task. If for some reason you need that mapping you would have to add a custom field. Why do you need to map that record to the asset?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 07:27 AM
So that i can keep record of asset. against which RITM, i have issued the asset.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 09:33 AM
HI @Gulfam Shafee3 ,
I trust you are doing great.
Please find the sample code for the same :
(function executeRule(current, previous /*null when async*/) {
// Check if the task is closed complete
if (current.state == 'closed_complete') {
var assetId = current.u_asset; // Assuming 'u_asset' is the field for asset on the task
// Query the asset record
var asset = new GlideRecord('alm_asset');
if (asset.get(assetId)) {
asset.install_status = 'in_use'; // Set the asset state to 'In Use'
asset.u_request_item = current.request_item; // Linking the RITM to the asset
asset.update();
}
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 10:41 PM
Thank you Amit for your response.
Actually I am using flow designer to update the asset based on selection.
I have achieved it.
I used "Get Catalog variable" OOB action. where I can fetch catalog variable on flow designer
Then I used "look up record" and search for the asset which I want to update.
After that I have used the "update record" OOB action to update the asset.