Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Reset Production Order status to Created stage through X++ in Ax 2012R3 / D365 Finance & Operations

$
0
0

Hi Everyone,

I need urgent help.

I want to reset the Production order through X++ to Created Stage.
I have written below job code in AX2012 R3 which was written on multiple blogs.
But when I try to run job facing below error,

"The status cannot be reset from Scheduled to Created on production PRD/18-19/003221 because of the parameter setup."
"Update has been canceled."

Can anybody suggest some solution on this?

Below is the logic written in Job

static void resetProductionOrder_TestJob(Args _args)
{

ProdId _prodId = "PRD/18-19/003221";
ProdMultiStatusDecrease prodMultiStatusDecrease;

ProdParmStatusDecrease prodParmStatusDecrease;

ProdTable prodTable;

Args args = new Args();

;


Try

{

ttsbegin;

prodTable = ProdTable::find(_prodId,true);

if (prodTable.ProdStatus > prodStatus::Created)

{

args.record(prodTable);

select prodParmStatusDecrease where prodParmStatusDecrease.ProdId == prodTable.ProdId;


if (!prodParmStatusDecrease.RecId)

{

prodParmStatusDecrease.clear();

prodParmStatusDecrease.initFromProdTable(prodTable);

prodParmStatusDecrease.WantedStatus = ProdStatus::Created;

prodParmStatusDecrease.ParmId = NumberSeq::newGetNum(CompanyInfo::numRefParmId()).num();

prodParmStatusDecrease.insert();

}

prodMultiStatusDecrease = prodMultiStatusDecrease::construct(args);

prodMultiStatusDecrease.initParmBuffer(prodParmStatusDecrease);

prodMultiStatusDecrease.parmId(prodParmStatusDecrease.ParmId);

prodMultiStatusDecrease.run();

}

ttsCommit;
info("Done");
}

Catch (Exception::error)

{

checkFailed(strFmt("Delete of Production order %1 is failed.", _prodId));

}

}

.

Thank you in advance


Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>