Hello ,
So i am trying to make a script task to calculate loan payment using the javascript.
here’s what i tried :
var down_payment = execution.getVariable(“down_payment”);
var amount = execution.getVariable(“loan_amount”);
var years = execution.getVariable(“years”);
var payment = ((amount - down_payment ) (1.05)^5) / (years12) ;
I specify the payment as a result variable for the script.However , I have two problems :
When the script task is executed , the payment variable is shwoing like this:
“payment”: {
“type”: “String”,
“value”: “\nvar down_payment = (Integer) execution.getVariable(“down_payment”);\nvar amount = (Integer) execution.getVariable(“loan_amount”);\nvar years = execution.getVariable(“years”);\nvar payment = (Integer) ((amount - down_payment ) (1.05)^5) / (years12) ;\n\nexecution.setVariable(“payment”,payment);\n”,
“valueInfo”: {}
}
How Can i fix this and get the value of the payment variable?Is there any way to show the result variable value in camunda without setting it to a form variable after the script task?
Thank You!