createPercentageMethod(itcoa_segments, primary_segment, percentage)

This API creates an allocation method with the specified values for the segments and the percentage for the allocation amount.

Table 1. Parameters
Name Type Description
itcoa_segments number The values for the segments defined in the IT Chart of Accounts.
primary_segment string The primary segment to which the expense is allocated.
percentage number The percentage of the total amount for this method. Entering a percentage value greater than zero uses the createMethod function of type percentage. If no value is specified for the percentage parameter, the createPercentageMethod creates a new cost allocation method record.
Table 2. Returns
Type Description
Gliderecord The allocation method

The following example uses the Cost center by number of incidents called metric script. This script calls the FinancialMethodUtils script include.

function createMethods(){var methodUtils =new FinancialMethodUtils();var methods =[];
	//Query the incident table grouped by caller_id.cost_centervar ga =new GlideAggregate('incident');
	//Determine the total number of incidentsvar total =0;while(
		total += parseInt(ga.getAggregate('COUNT'));	
	var dmtable_cmn_cost_center = methodUtils.getDimensionTableFromTransactionTable('cmn_cost_center');//Create methods weighted on number of callers per departmentwhile({var cmn_cost_center = ga.getValue('caller_id.cost_center');var dm_cmn_cost_center = methodUtils.getDimension(dmtable_cmn_cost_center, cmn_cost_center);var count = ga.getAggregate('COUNT');var percentage =(count *100)/ total;
			itcoa_segments ={
				segment7 : dm_cmn_cost_center
			methods.push(methodUtils.createPercentageMethod(itcoa_segments, dmtable_cmn_cost_center, percentage));}}
	return methods;}