how to get asset id from dimensions

HI,

i am trying to import fixed asset journals for that i wrote some code its good…

but in that hoe to fetch asset id for dimension field… see

ledgerJournalTrans.LedgerDimension =AxdDimensionUtil::getLedgerAccountId

i strucked here …

can anybody suggest hoe to get asset id for this…

Thanks,

Hope it will be better if you can import from excel using office add in.

Think so, not sure.

Regards,

Jaleel

HI,

through code assigning assertid to dimension field is not possible?..

thanks,

Hi Suresh,

Fixed asset Journal is related with mainly two tables LedgerJournalTable and LedgerJournalTrans_Asset ( which holds recid of ledgerjournaltable and asset BookId **) .

Create a Fixed Asset Journal say Journal Number ''FA00001’ and hardcode it in **journalTrans.**parmJournalNum(); in below code.

static void FixedAssetJournal(Args _args)

// AxLedgerJournalTable journalTable;

AxLedgerJournalTrans journalTrans;

container acctPattern;

container offSetAcctPattern;

LedgerJournalTable ledgerJournalTable;

ledgerJournalCheckPost ledgerJournalCheckPost;

NumberSeq NumberSeq;

LedgerJournalTrans_Asset ledgerJournalTrans_Asset

str AssetId = 00001;//todo: Provide valid assetId

;

NumberSeq =NumberSeq::newGetNumFromCode(LedgerParameters::numRefLedgerJournalizeNum().numberSequenceTable().NumberSequence);

//journalTable = new AxLedgerJournalTable();

journalTrans = new AxLedgerJournalTrans();

journalTrans.parmVoucher(NumberSeq.num());

//Journal Name

// journalTable.parmJournalName(“GenJrn”);

//journalTable.save();

//journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);

//todo: Change Journal Number w.r.t requirement

journalTrans.parmJournalNum(‘FA00001’);//todo: provide journal number

journalTrans.parmTransDate(today());

//Fixed asset Id

journalTrans.parmLedgerDimension(DimensionStorage::getDynamicAccount(AssetId,LedgerJournalACType::FixedAssets));

journalTrans.parmCurrencyCode(“USD”);

journalTrans.parmAmountCurCredit(20);

journalTrans.parmAmountCurDebit(0);

journalTrans.parmAccountType(LedgerJournalACType::FixedAssets);

journalTrans.parmDefaultDimension(AssetTable::find(AssetId).defaultDimension(AssetId));

journalTrans.parmOffsetAccountType(LedgerJournalACType:: Ledger );

journalTrans.parmOffsetLedgerDimension(OffsetLedgerDimension);//Todo: offset dim

//journalTrans.parmOffsetLedgerDimension(DimensionDefaultingService::serviceCreateLedgerDimension(0,

// AssetTable::find(FATransAcqTmp.AssetId).defaultDimension(FATransAcqTmp.AssetId)));

// journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId( offSetAcctPattern));

journalTrans.save();

if (journalTrans.ledgerJournalTrans().isFixedAssetsTransaction())

{

ledgerJournalTrans_Asset.clear();

ledgerJournalTrans_Asset.initValue();

ledgerJournalTrans_Asset.RefRecId = journalTrans.ledgerJournalTrans().RecId;

ledgerJournalTrans_Asset.AssetId = journalTrans.ledgerJournalTrans().getAssetId();

ledgerJournalTrans_Asset.Company = journalTrans.ledgerJournalTrans().getAssetCompany();

ledgerJournalTrans_Asset.TransType = AssetTransTypeJournal::Acquisition;

ledgerJournalTrans_Asset.BookId = ‘SL’;//Todo: Provide valid asset book id

if (!ledgerJournalTrans_Asset.validateWrite())

throw Exception::Error;

ledgerJournalTrans_Asset.insert();

}

info(‘Insert’);

}