Apr 27, 2014

Job to create unreconciled expense by using service class in AX2012


Creating unreconciled expense by using service class




static void CreateunreconciledExpense(Args _args)
{
    TrvUnreconciledExpenseRecord newRecord;
    TrvUnreconciledExpenseService service = new TrvUnreconciledExpenseService(); 


    newRecord = new TrvUnreconciledExpenseRecord();
    newRecord.parmCostType('Car Rental');
   // newRecord.parmMerchantId('Bad car rental place');
    newRecord.parmTransactionCurrencyAmount(600);
    newRecord.parmTransactionCurrencyCode('EUR');     
    newRecord.parmTransactionDate(DateTimeUtil::date(DateTimeUtil::addDays(DateTimeUtil::utcNow(), -1228)));


    newRecord.parmUserNetworkAlias('XXXXX'); // pass the username
    newRecord.parmUserNetworkDomain('XXXXXXXXXX'); // Pass the network domian 


    service.createRecord(newRecord);
    info("record created");
}

No comments: