Expense Report Policy

You can define policies to limit the expenses your employees can enter. Expense reports must satisfy all defined filters to apply a limit. When you select multiple entries for filters, expense reports must satisfy at least one selection for each applied filter. For example, you create a policy to apply to airfare and meals for your parent subsidiary. The limit applies to any expense report entered by a parent company employee with expenses for airfare or meals. The expense report does not have to include expenses for both airfare and meals.

This transaction is available when the Expense Reports feature is enabled at Setup > Company > Enable Features, on the Employees subtab.

For help working with this record in the UI, see Expense Report Policies.

The internal ID for this record is expensereportpolicy. The internal ID of the new subrecord is erpolicynotification and the sublist internal ID is notification.

See the SuiteScript Records Browser for all internal IDs associated with this record.

Note:

For information about using the SuiteScript Records Browser, see Working with the SuiteScript Records Browser in the NetSuite Help Center.

For information about scripting with this record in SuiteScript, see the following help topics:

Supported Script Types

The expense report policy record is scriptable in both client and server SuiteScript.

Supported Functions

The expense report policy record supports the following functions: read, create, update, copy, delete, and search.

Code Samples

          /**

*@NapiVersion 2.x

*/



define(['N/record'], function(record) {

   var startDate = new Date();

   var endDate = startDate;

   endDate.setDate(startDate.getDate() + 90);



   var expenseReportPolicy = record.create({

      type: record.Type.EXPENSE_REPORT_POLICY,

      isDynamic: true

   });



   expenseReportPolicy.setValue({

      fieldId: 'name',

      value: 'ERpolicy-meals4'

   });



   expenseReportPolicy.setValue({

      fieldId: 'startdate',

      value: startDate

   });



   expenseReportPolicy.setValue({

      fieldId: 'enddate',

      value: endDate

   });



   expenseReportPolicy.setText({

      fieldId: 'subsidiary',

      text: 'UK Sub'

   });



   expenseReportPolicy.setText({

      fieldId: 'location',

      text: ['Location UK', 'Location UK 2']

   });



   expenseReportPolicy.setText({

      fieldId: 'expensecategory',

      text: 'Meals'

   });



   expenseReportPolicy.setText({

      fieldId: 'limittype',

      text: 'Per day'

   });



   expenseReportPolicy.setText({

      fieldId: 'action',

      text: 'Warn but allow expenses outside limit'

   });



   expenseReportPolicy.setValue({

      fieldId: 'maxamount',

      value: 50

   });



   expenseReportPolicy.selectNewLine({

      sublistId: 'notification'

   });



   expenseReportPolicy.setCurrentSublistValue({

      sublistId: 'notification',

      fieldId: 'entity',

      value: 343

   });



   expenseReportPolicy.commitLine({

      sublistId: 'notification'

   });



   var expenseReportPolicyId = expenseReportPolicy.save();

   

   // Test of record load

   try {

      var testExpenseReportPolicy = record.load({

         type: record.Type.EXPENSE_REPORT_POLICY,

         id: expenseReportPolicyId

      });

   }

   finally {

      if (expenseReportPolicyId != null) {

         record.delete({

            type: record.Type.EXPENSE_REPORT_POLICY,

            id: expenseReportPolicyId

         })

      }

   }

}); 

        

Related Topics

General Notices