static void
createBudgetHeaderAndLine(Args _args)
{
BudgetTransactionHeader header;
BudgetTransactionLine
line;
AxBudgetTransactionHeader axHeader;
AxBudgetTransactionLine axLine;
header.initValue();
header.Date = 18\09\2017;
header.BudgetModelId =
PurchParameters::find().GRWModelId;
header.BudgetTransactionCode =
BudgetTransactionCode::findByBudgetTransactionCode(PurchParameters::find().GRWBudgetTransactionCode).RecId;
axHeader =
AxBudgetTransactionHeader::newBudgetTransactionHeader(header);
axHeader.save();
axLine = AxBudgetTransactionLine::construct();
axLine.parmBudgetTransactionHeader(axHeader.parmRecId());
axLine.parmLedgerDimension(5637146826);
axLine.parmDate(18\09\2017);
axLine.parmTransactionCurrencyAmount(30);
axLine.parmBudgetType(BudgetType::Expense);
axLine.parmTransactionCurrency("MXN");
axLine.save();
info(strFmt("Entrada de presupuesto creada: %1",
header.TransactionNumber));
}
Y en Ax se ve algo como esto:
Post relacionados:
Autoliquidación de transacciones (Auto settlement) por código X++ - Dynamics Ax 2012
Validar si existe un archivo y la extensión del mismo por código - Dynamics Ax 2012
Lista de remisiones asociadas a una factura por código X++ en Dynamics Ax 2012
No olvides que te puedes unir a la página en Facebook Aprendiendo Dynamics Ax donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma.
Hi Yered Castro, I follow this article to create Budget register and budget account entry, but I got an error when creating budget account entry (BudgetTransactionLine)
ResponderBorrarHere is the error :
Stack trace: The company BudgetSourceRecId does not exist.
Do you know how to solve it?
Thanks in advance
Regards,
Bintang
Hi, in the line axLine.parmBudgetTransactionHeader(axHeader.parmRecId()); should be the parmRecId by AxBudgetTransactionHeader class, did you put this line?
BorrarYes I did, if you don't mind please look on my post at ax community for the detail
Borrarhttps://community.dynamics.com/ax/f/33/p/257947/723665
Thanks before
I find the solution, there's something missed while creating header. I missed BudgetModelDataAreaId
BorrarbudgetHeader.parmBudgetModelDataAreaId(CompanyInfo::findRecId(CompanyInfo::current()).DataArea);
So now I can make it, thank you