- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2022 12:46 AM
Why am I getting '0' value all the time? What am I doing wrong?
Im trying to calculate a value using and then populate using calculated script.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2022 01:26 AM
Hi @Alon Grod ,
Return the calculated value as below :- Calculated value must be on u_saving field.
(function calculatedFieldValue(current) {
var a = parseInt(current.cost);
var b = parseInt(current.u_competitive_proposal);
var c = a - b;
if (c > 0){
return parseInt(c);
}
else {
return parseInt(0);
}
})(current);
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2022 01:04 AM
Hello @Alon Grod ,
can you please Include your script here? would be easy to analyze the issue
Regards,
Shyamkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2022 01:07 AM
(function calculatedFieldValue(current) {
var a = parseInt(current.cost);
var b = parseInt(current.u_competitive_proposal);
var c = a - b;
if (c > 0){
current.u_saving = parseInt(c);
}
else {
current.u_saving = 0;
}
// return the calculated value
})(current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2022 01:26 AM
Hi @Alon Grod ,
Return the calculated value as below :- Calculated value must be on u_saving field.
(function calculatedFieldValue(current) {
var a = parseInt(current.cost);
var b = parseInt(current.u_competitive_proposal);
var c = a - b;
if (c > 0){
return parseInt(c);
}
else {
return parseInt(0);
}
})(current);