Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

ExpenseLine- Global

The ExpenseLine script include is used by various cost management processes and can also be used for generating expense line (fm_expense_line) records from your own server-side scripts.

This script include requires the Cost Management (com.snc.cost_management) plugin.

Parent Topic:Server API reference

ExpenseLine - ExpenseLine (GlideRecord source, Number amount, String description)

Constructor for ExpenseLine object.

NameTypeDescription
sourceGlideRecordGlideRecord identifying the source of the expense
amountNumberDecimal number identifying the amount of the expense
descriptionString(Optional) Description of the expense.
TypeDescription
ExpenseLine objectThe ExpenseLine object just instantiated.
//get some random CI to be used as an expense source
        var ci = new GlideRecord("cmdb_ci_server");
        ci.query();
        ci.next();

        //create expense line
        var exp = new ExpenseLine(ci, 234.56, "Test expense line");

ExpenseLine - createExpense()

Creates a new expense line record.

NameTypeDescription
None  
TypeDescription
BooleanTrue if the expense line was successfully created.
//get some random CI to be used as an expense sourcevar ci =new GlideRecord("cmdb_ci_server");
ci.query();
ci.next();

//create expense line
var exp =new ExpenseLine(ci,234.56,"Test expense line");
exp.setSummaryType("run_business");
var success = exp.createExpense();

ExpenseLine - processCIParents()

Used internally by the createExpense method to process CI relationships when the expense source is a cmdb_ci record.

NameTypeDescription
None  
TypeDescription
void 

ExpenseLine - setCostSource(GlideRecord costSource)

Identifies the source rate card or distribution cost that was the source of expense line generation.

This is not the source (CI, task) of the expense.

NameTypeDescription
costSourceGlideRecordGlideRecord of CI rate card cost, distribution cost, or task rate card. This is generally only used for system-generated expense lines.
TypeDescription
void 

ExpenseLine - setDescription(String description)

Defines the description of an expense.

NameTypeDescription
descriptionStringDescription of expense.
TypeDescription
void 

ExpenseLine - setParent(GlideRecord expense)

Sets the parent field on the expense line.

This is generally only used by the system when generating indirect expenses such as business service aggregated expenses.

NameTypeDescription
expenseGlideRecordParent expense line record.
TypeDescription
void 

ExpenseLine - setRecurring(Boolean recurring)

Flags the expense as recurring by setting the recurring field to true.

Expense lines are set to false by default so there is no need to call setRecurring(false).

NameTypeDescription
recurringBooleanSet to true to identify expense line as a recurring expense.
TypeDescription
void 

ExpenseLine - setSummaryType(String summaryType)

Sets a value for the expense line summary_type field.

NameTypeDescription
summaryTypeStringTypically you would set this to a value already specified in the expense line summary type field choice list.
TypeDescription
void 
//get some random CI to be used as an expense sourcevar ci =new GlideRecord("cmdb_ci_server");
ci.query();
ci.next();

//create expense line
var exp =new ExpenseLine(ci,234.56,"Test expense line");
exp.setSummaryType("run_business");