
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2018 12:53 PM
I am working to setup the Asset Management module and came across an issue. I created a report showing the depreciation details for our assets, however, I the report does not force the depreciated amounts to update depending on the date the report was run.
I understand that this cannot be done within the report itself, but I am looking for a script that I can setup as a scheduled job to update the depreciation amount on a daily basis automatically so when this report is requested I do not have to manually go to each asset record and click the 'calculate depreciation' button.
I have already tried taking the UI Action script for the calculate deprecation and adding it into a schedule job, but it did not work so I assume I am missing something. Is this possible?
(new DepreciationUtils()).calcDepreciation(current)
Solved! Go to Solution.
- Labels:
-
Enterprise Asset Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2018 01:07 PM
You'll need to query for the assets you need before passing them into the function. Something like this should work better.
var alm = new GlideRecord('alm_hardware');
alm.query();
while (alm.next()) {
(new DepreciationUtils()).calcDepreciation(alm)
}
You might also consider adding an 'addQuery' line before the 'alm.query()' line to restrict this somewhat so that it's not running against assets that don't need it, but that's the general idea.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2018 01:07 PM
You'll need to query for the assets you need before passing them into the function. Something like this should work better.
var alm = new GlideRecord('alm_hardware');
alm.query();
while (alm.next()) {
(new DepreciationUtils()).calcDepreciation(alm)
}
You might also consider adding an 'addQuery' line before the 'alm.query()' line to restrict this somewhat so that it's not running against assets that don't need it, but that's the general idea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 10:55 AM
It is not working for me as well. @AndyB5000 did it work for you ?