FinancialsWidgetUtil - Scoped
The FinancialsWidgetUtil script include provides methods to customize widgets in the Financials section of Project Workspace and Strategic Planning Workspace.
- Budget
- Estimate at Completion
- Planned Cost
- Actual Cost to Date
In this example from Project Workspace, the Planned Cost widget has child widgets that show CapEx and OpEx values, while the Budget widget doesn't have any child widgets.
To use this script include, create a child widget with one of the available financials widgets as the parent. Use the methods from this script include in the Script field of the child widget record.
The FinancialsWidgetUtil script include requires the Financials Core application (sn_invst_pln), as well as the Strategic Planning application (sn_apw_advanced) or Project Workspace application (sn_pw). This script include is provided within the sn_invst_pln namespace.
FinancialsWidgetUtil - FinancialsWidgetUtil(GlideRecord investmentGr, Object timeScope, String expenseType)
Instantiates a FinancialsWidgetUtil object.
This object is used to get aggregate values such as budget and planned cost for an investment.
| Name | Type | Description |
|---|---|---|
| investmentGr | GlideRecord | Investment to get aggregate values for. Table: Investment [sn_invst_pln_invst_investment] |
| timeScope | Object | List of fiscal periods to use as the start and end dates for the aggregation. |
| timeScope.startFiscalPeriodSysId | String | Sys_id of the fiscal period to use as the start date for the aggregation. Table: Fiscal Period [fiscal_period] |
| timeScope.endFiscalPeriodSysId | String | Sys_id of the fiscal period to use as the end date for the aggregation. Table: Fiscal Period [fiscal_period] |
| expenseType | String | Optional. Type of expense to include in the aggregation, such as capital expenditure (CapEx) or operating expense (OpEx). Valid values:
|
This example instantiates a FinancialsWidgetUtil object that can be used to return aggregate values for an investment where the expense type is CapEx and the time period is context.timeScope.
var context = JSON.parse(context);
var investment = context.investment;
(function initializeFWU() {
var invGr = new GlideRecord('sn_invst_pln_invst_investment');
if (invGr.get(investment.sys_id)) {
var capexCost = new sn_invst_pln.FinancialsWidgetUtil(invGr, context.timeScope, 'capex');
}
})();
FinancialsWidgetUtil - getActuals()
Returns the actual cost for any planning items and work items linked to an investment.
To use this method, create a child widget with the Actual Cost to Date widget as the parent. Use this method in the Script field of the child widget record.
The actual cost returned by this method is for the time period and expense type specified when instantiating the FinancialsWidgetUtil object.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Object | Object containing the display value and value for the actual cost. |
| <Object>.displayValue | Display value of the actual cost, such as $1.00 K.Data type: String |
| <Object>.value | Value of the actual cost, such as 1000.Data type: Number |
This example adds a child widget to the Actual Cost to Date widget that shows the actual cost for OpEx only.
var context = JSON.parse(context);
var investment = context.investment;
(function getCost() {
var invGr = new GlideRecord('sn_invst_pln_invst_investment');
if (invGr.get(investment.sys_id)) {
var opexCost = new sn_invst_pln.FinancialsWidgetUtil(invGr, context.timeScope, 'opex').getActuals();
return {
displayValue: PPMCurrencyHelper.getFormattedAmountWithCurrency(opexCost.value),
value: opexCost.value
};
}
})();
FinancialsWidgetUtil - getBudget()
Returns the budget for any planning items and work items linked to an investment.
To use this method, create a child widget with the Budget widget as the parent. Use this method in the Script field of the child widget record.
The budget returned by this method is for the time period and expense type specified when instantiating the FinancialsWidgetUtil object.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Object | Object containing the display value and value for the budget. |
| <Object>.displayValue | Display value of the budget, such as $2.50 K.Data type: String |
| <Object>.value | Value of the budget, such as 2500.Data type: Number |
This example adds a child widget to the Budget widget that shows the budget for OpEx only.
var context = JSON.parse(context);
var investment = context.investment;
(function getCost() {
var invGr = new GlideRecord('sn_invst_pln_invst_investment');
if (invGr.get(investment.sys_id)) {
var opexCost = new sn_invst_pln.FinancialsWidgetUtil(invGr, context.timeScope, 'opex').getBudget();
return {
displayValue: PPMCurrencyHelper.getFormattedAmountWithCurrency(opexCost.value),
value: opexCost.value
};
}
})();
FinancialsWidgetUtil - getEAC()
Returns the estimate at completion (EAC) value for any planning items and work items linked to an investment.
To use this method, create a child widget with the Estimate at Completion widget as the parent. Use this method in the Script field of the child widget record.
The EAC value returned by this method is for the time period and expense type specified when instantiating the FinancialsWidgetUtil object.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Object | Object containing the display value and value for the EAC. |
| <Object>.displayValue | Display value of the EAC, such as $2.38 K.Data type: String |
| <Object>.value | Value of the EAC, such as 2380.Data type: Number |
This example adds a child widget to the Estimate at Completion widget that shows the EAC for OpEx only.
var context = JSON.parse(context);
var investment = context.investment;
(function getCost() {
var invGr = new GlideRecord('sn_invst_pln_invst_investment');
if (invGr.get(investment.sys_id)) {
var opexCost = new sn_invst_pln.FinancialsWidgetUtil(invGr, context.timeScope, 'opex').getEAC();
return {
displayValue: PPMCurrencyHelper.getFormattedAmountWithCurrency(opexCost.value),
value: opexCost.value
};
}
})();
FinancialsWidgetUtil - getPlannedCost()
Returns the planned cost for any planning items and work items linked to an investment.
To use this method, create a child widget with the Planned Cost widget as the parent. Use this method in the Script field of the child widget record.
The planned cost returned by this method is for the time period and expense type specified when instantiating the FinancialsWidgetUtil object.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Object | Object containing the display value and value for the planned cost. |
| <Object>.displayValue | Display value of the planned cost, such as $4.05 K.Data type: String |
| <Object>.value | Value of the planned cost, such as 4050.Data type: Number |
This example adds a child widget to the Planned Cost widget that shows the planned cost for OpEx only.
var context = JSON.parse(context);
var investment = context.investment;
(function getCost() {
var invGr = new GlideRecord('sn_invst_pln_invst_investment');
if (invGr.get(investment.sys_id)) {
var opexCost = new sn_invst_pln.FinancialsWidgetUtil(invGr, context.timeScope, 'opex').getPlannedCost();
return {
displayValue: PPMCurrencyHelper.getFormattedAmountWithCurrency(opexCost.value),
value: opexCost.value
};
}
})();