I'm trying to develop a solution to import expenses using the Financial Institution Parser. When I import I have a success message, but nothing is imported.
Follow steps:
Transactions > Bank > Imported Employee Expenses > Upload File
Upload a csv file. Sample can be anything, because I'm hard coding for test.
Success on uploading.
Transactions > Bank > Imported Employee Expenses
Nothing is imported:
Customization > Plug-ins > Plug-ins implementations
Here's my parse code with a sample to try to create an expense record.
References:
Importing Corporate Card Data
createAccountData()
createNewTransaction()
/**
*
* @NScriptType FIParserPlugin
* @NApiVersion 2.1
* @NModuleScope TargetAccount
*/
define(['N/xml'], function (nXml) {
var module = {};
module.getExpenseCodes = function (scriptContext) {
scriptContext.createNewExpenseCode({
code: 'DEBIT',
description: 'DEBIT'
});
scriptContext.createNewExpenseCode({
code: 'CREDIT',
description: 'CREDIT'
});
}
module.parseData = function (context) {
const cardHolder = 'felipe bogo';
log.debug('card holder', cardHolder)
// tried both, internal id and entityid
const empid = '588198'
//const empid = 'felipe bogo'
log.debug('emp id', empid)
const newAccountData = context.createAccountData({
//accountId: '',
employeeId: empid,
cardHolder: cardHolder,
//dataAsOfDate: '2024-06-20',
//openingBalance: 0,
// closingBalance: 0,
//currentBalance: 0,
// dueBalance: 0
});
newAccountData.createNewTransaction({
// transactionTypeCode: '',
// uniqueId: '',
// id: '',
// payee: '',
// transactionStatus: '',
// customerReferenceId: '',
// customerName: '',
// invoiceReferenceIds: [],
date: '2024-05-02',
memo: 'TESTE MEMO',
amount: 1000,
expenseCode: 'DEBIT',
billedTaxAmount: 23,
localChargeAmount: 14,
localTaxAmount: 21,
// currency: 'USA',
currencyExchangeRate: 1.1
});
};
return module;
});
Setup > accounting > Financial Institution
My profile is configured as follows:
Lists > Relationships > Employee > edit employee > Under Human resources
I also configure may employee profile to add the corporate card name
I have switched the Match employee by Id to test, using both entityid and internal id to test, but none of the tries worked.
Anyone could point if I'm doing anything wrong?