Service Desk Plus cloud custom script add number values and display result

Service Desk Plus cloud custom script add number values and display result

Hi,

Is it possible to create a custom scrip for Manage Engine Service Desk Plus cloud version to take the number values of two different fields and add them together and display the total number value in a third field.

I have tried scripts created by ZIA Code generator and Co-Pilot. I could not find one script yet that gives the desired result or no error.

 // Assume field names: field1, field2, totalField
var field1Value = parseFloat(form.getField('dbl_stand_in_value').getValue()) || 0;
var field2Value = parseFloat(form.getField('dbl_oa_amount').getValue()) || 0;

var total = field1Value + field2Value;

// Set the total in the third field
form.getField('dbl_offer_f').setValue(total); 
CS.end();  

gives error:

Any help will be apreciated
Regards

                  New to ADSelfService Plus?