Can we calculate depreciation on monthly basis

Prakash_S
Tera Contributor

Hi Expert,

 

Can we calculate asset depreciation on monthly basis, if yes then how?

1 ACCEPTED SOLUTION

Runjay Patel
Giga Sage

Hi @Prakash_S ,

 

Yes you can calculate depreciation on monthly basis, follow below step.

  1. Create one scheduled job and set run as monthly.
  2. RunjayPatel_0-1734010305284.png

     

  3. Set the run time and date.
  4. RunjayPatel_1-1734010400834.png

     

  5. Use below script.

 

 

var alm = new GlideRecord('alm_hardware');
alm.query();
while (alm.next()) {
    (new DepreciationUtils()).calcDepreciation(alm)
}

 

 

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

View solution in original post

If you have basic knowledge in ServiceNow and face difficulties writing script in ServiceNow then this ServiceNow scripting tutorial is for you. In this tutorial i have explained from very basic to advance level of scripting. I have used real word use case to explain the scenarios. After watching
4 REPLIES 4

Runjay Patel
Giga Sage

Hi @Prakash_S ,

 

Yes you can calculate depreciation on monthly basis, follow below step.

  1. Create one scheduled job and set run as monthly.
  2. RunjayPatel_0-1734010305284.png

     

  3. Set the run time and date.
  4. RunjayPatel_1-1734010400834.png

     

  5. Use below script.

 

 

var alm = new GlideRecord('alm_hardware');
alm.query();
while (alm.next()) {
    (new DepreciationUtils()).calcDepreciation(alm)
}

 

 

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

If you have basic knowledge in ServiceNow and face difficulties writing script in ServiceNow then this ServiceNow scripting tutorial is for you. In this tutorial i have explained from very basic to advance level of scripting. I have used real word use case to explain the scenarios. After watching

Thanks @Runjay Patel  for quick help, will try this.

Donna Edwards
Tera Contributor

We have done this in our instance.  The depreciation amount is calculating according to our formula.  Our formula is Cost/number of months (useful life 5yrs-60mos).  example cost = 10,682.00, useful life is 5 yrs(60mos)  the monthly depreciation would be $10,682.00/60 =$178.03 per month.  The system does not seem to be calculating in this manner.

We have done this in our instance.  The depreciation amount is NOT calculating according to our formula.  Our formula is Cost/number of months (useful life 5yrs-60mos).  example cost = 10,682.00, useful life is 5 yrs(60mos)  the monthly depreciation would be $10,682.00/60 =$178.03 per month.  The system does not seem to be calculating in this manner.

DonnaEdwards_0-1734631773192.pngDonnaEdwards_1-1734631809836.png