-1

I'm creating a journal entry through x++ with fixed assets.. I set the ledger transaction with a fixed asset account, save and then use ledger journal engine to "refresh" and trigger it so it sets the value model combination behind the scenes. It does set the value model, but when I go to validate it complains that its not set. When I click on the line and go validate, the error essentially Disappears and goes to the next line to complain. If i click on every line and click validate , the error goes away and eventually the journal is ok to post. My question is, is there something else to call or trigger where it will know that this is set properly without bringing up this error.

enter image description here enter image description here

   journalTrans.parmLedgerDimension(DimensionStorage::getDynamicAccount(DataRow.get_Item("Account"),   LedgerJournalACType::FixedAssets));
   journalTrans.save();

   ledgerJournalTrans = journalTrans.ledgerJournalTrans();
   lje = LedgerJournalEngine::construct(ledgerJournalTrans.ledgerJournalTable().JournalType);
   lje.accountModified(LedgerJournalTrans);
Sirus
  • 382
  • 1
  • 8
  • 35
  • For the future, don't post code that leaves off the variable definitions. `journalTrans` can be anything. I just recognize the pattern and know it's probably `AxLedgerJournalTrans` – Alex Kwitny Jun 16 '20 at 23:17

1 Answers1

-1

We need more code to best answer your question. We're not here to really guess what could be wrong, when just looking at the code we can give an answer.

Based on just what I see, did you try the obvious stuff, such as making sure your record is selected for update and you perform an update after?

This may be too obvious, but since we only have a few lines of code this is my best guess. Try changing your bottom 3 lines to these 4 lines.

ledgerJournalTrans = LedgerJournalTrans::findRecId(journalTrans.ledgerJournalTrans().RecId, true);
lje = LedgerJournalEngine::construct(ledgerJournalTrans.ledgerJournalTable().JournalType);
lje.accountModified(LedgerJournalTrans);    

ledgerJournalTrans.update();
Alex Kwitny
  • 11,211
  • 2
  • 49
  • 71
  • yes the variable journalTrans is AxLedgerJournalTrans. journalTrans.parmAccountType(LedgerJournalACType::FixedAssets); journalTrans.parmOffsetAccountType(LedgerJournalACType::Ledger);.. ledgerJournalTrans is ledgerJournalTrans. Also what you suggested the first line doesn't work, the dimensions don't even show up at all if i do that. you google that? i left out the update and it doesn't matter if you put the update or not, it does the same thing. – Sirus Jun 17 '20 at 18:05
  • @Sirus - You need to provide more code. My answer is valid, because in the code you provided you left off necessary bits. If you would have started with more code, you would get a better answer. Downvoting my answer is a good way to get me to move on to another question. Hope you figure it out. – Alex Kwitny Jun 17 '20 at 23:37
  • I figured I provided enough, the rest is not that useful for what i'm trying to accomplish, other than a few declarations I left out.. ok – Sirus Jun 18 '20 at 18:42
  • @Sirus - No you did not provide enough. Everything you say you're trying to accomplish is mostly useless if we don't have code to verify it. You should provide where the errors are happening in code too as they point to the problem. Look at `\Classes\AssetPost\check #59`. It's saying `assetTrans.BookId` is not populated. Right now, I'm basically playing Sherock Holmes trying to solve this puzzle you've provided. I can already see from the couple lines of code that you've provided you're not doing a standard approach. – Alex Kwitny Jun 18 '20 at 19:31