Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how depreciation date will update in HW assets

Royal1
Tera Contributor

 

How depreciation value will calculate and how the depreciation date will get update , i want to know the logic or calculate on how the depreciation will calculate 

 

Royal1_0-1702459478076.png

 

3 REPLIES 3

Tai Vu
Kilo Patron
Kilo Patron

Hi @Royal1 

Let's have a look into the business rule below. 

Name: Set Depreciation values

URL: https://<instance_name>/sys_script.do?sys_id=d48da842dbc302002aaf71d8f0b8f54e

It set value for the depreciation_date field based on the received date or the install_date date

 

 

if(!current.depreciation_date.changes() && current.depreciation) {
    if (GlidePluginManager.isActive('com.snc.procurement') && current.receiving_line) {
        current.depreciation_date = current.receiving_line.received;
    } else if (current.install_date) {
        current.depreciation_date = current.install_date;
    }
}

 

 

And below script include for calculation of Residual date and Depreciated amount.

Script Include: DepreciationUtils

Function: calcDepreciation

 

 

Cheers,

Tai Vu

Royal1
Tera Contributor

This script will work in the alm_asset but if its a Hardware asset alm_hardware 

Hi @Royal1 

Yes the Hardware [alm_hardware] is the child table, which extends the Asset [alm_asset] table. So, the Business Rule will apply to the Hardware table as well.

You can have a look into the Dictionary of the Depreciation and Depreciation effective date fields. These fields actually come from the Asset table.

Timi_0-1702527417046.png

 

Cheers,

Tai Vu