Skip to content

Instantly share code, notes, and snippets.

@cba2ry
cba2ry / MortgageCalculatorWithMagic.txt
Created April 19, 2012 17:45 — forked from sbob909/gist:1855055
Apex Plug-In for Force.com Cloud Flow Designer Workbook with proper calculation for monthly payment
global class MortgageCalculator implements Process.Plugin
{
global Process.PluginResult invoke(Process.PluginRequest request)
{
Double amount = (Double)request.inputParameters.get('Amount');
Double term = (Double)request.inputParameters.get('Term');
// in addition to to adding the calculation below, to use this in the Visual Workflow Workbook, tutorial #3,
// a third input called "Rate" will need to be defined for the calculate quote step: the screen input field "Interest_Rate".
Double rate = (Double)request.inputParameters.get('Rate');
Double monthlyrate = rate/(12*100);