- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2018 10:03 PM
Hi All,
Need business rule script , three fields are currency fields.
"Planned value to deliver" = Project "Allocated Cost" minus "Actual Cost with Resource Plan" = 100 - 0 = 100
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2018 10:44 PM
Hi Rani,
Try using following Before BR :
(function executeRule(current, previous /*null when async*/) {
var rate1 = parseFloat(current.u_field1);
var currencyCode1 = current.u_field1.getCurrencyCode();
var rate2 = parseFloat(current.u_field2);
var currencyCode2 = current.u_field2.getCurrencyCode();
var result = parseFloat(rate1-rate2);
gs.addInfoMessage(result);
current.setValue('u_field3',result);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2018 10:13 PM
Hi Rani,
if you are not getting expected answer/value try by using parseFloat(current.field_name), store values in variables and then apply your operations.
Mark if helpful
Thanks
Ajay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2018 10:23 PM
Hi Ajay can u provide the business rule script .here the problrm is three are currency fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2018 10:24 PM
Hi Ajay can u provide the business rule script .here the problem is three are currency fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2018 10:44 PM
Hi Rani,
Try using following Before BR :
(function executeRule(current, previous /*null when async*/) {
var rate1 = parseFloat(current.u_field1);
var currencyCode1 = current.u_field1.getCurrencyCode();
var rate2 = parseFloat(current.u_field2);
var currencyCode2 = current.u_field2.getCurrencyCode();
var result = parseFloat(rate1-rate2);
gs.addInfoMessage(result);
current.setValue('u_field3',result);