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.

Calculate percentage

Vdix
Tera Guru

Hello,

we have a requirement to show total value include tax.

e ,g cost 1 = 800

tax= 18% tax on 800

total= cost1+ 18% tax on 800,

 

I have tried flowing on load client script  but no luck,

function onLoad() {
//Type appropriate comment here, and begin script below
var sns = g_form.getValue('cost_1');
var ens = parseInt((cost_1)*18/100);
var total =parseInt(sns) + parseInt(ens);


alert(total);
g_form.setValue('t',total);
}

 

  

 

1 REPLY 1

Naveen4
Kilo Guru

Hi,  tried working fine for me.

 

function onLoad() {
//Type appropriate comment here, and begin script below
var q = g_form.getValue('cost'); //here the cost type is currency
var w =q.split(';')[1] ;
w = w.replace(/,/g, "");
var percent =w*1.8;


alert(q);

alert(w);
alert(percent);
}

 

give it a try,Mark helpful/correct if it helps.

 

Thanks,Naveen