- 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:47 PM
Replace my demo fields(field1,field2,field3 of type currency) with your fields of type currency.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 11:07 PM
Thank Ajay for your reply
but, i need after business rule because, the three fields are read only we auto populate the first two fields and then third fields must get subtract and autopopulate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 10:49 PM
Hi Rani,
Try with below script in before BR,
(function executeRule(current, previous /*null when async*/) {
var allocateCost = parseFloat(current.u_allocated_cost);
var actualCost = parseFloat(current.u_actual_cost);
var plannedValue = parseFloat(allocateCost - actualCost);
current.setValue('u_planned_value',plannedValue );
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 11:06 PM
Thank Ajay for your reply
but, i need after business rule because, the three fields are read only we auto populate the first two fields and then third fields must get subtract and autopopulate