Hi Experts,
I want to write a logic in MAP- InventInventoryJournalEntryMap in method -createJournalHeader with following condition.
1- If the JournalType = Movement and “Original journal No.” field has value.
2- If the existing Journal is “blocked” by system or any user.
If any of these two conditions are true than only the standard method will create a new journal.
For this I have written a code but not working.
Can anyone tell how can I achieve this
[ExtensionOf(mapstr(InventInventoryJournalEntryMap))]
public final class CreateInventoryMomentJournal_CAP_Extension
{
public static InventJournalTable createJournalHeader(JournalNameId _journalNameId, InventJournalType _expectedJournalType)
{
InventJournalTable inventJournalTable;
inventJournalTable = next createJournalHeader(_journalNameId, _expectedJournalType);
if (inventJournalTable.JournalType == InventJournalType::Movement && inventJournalTable.JournalIdOrignal ||
inventJournalTable.SystemBlocked == NoYes::Yes)
{
InventJournalName inventJournalName = InventJournalName::find(_journalNameId);
if (inventJournalName.
&& inventJournalName.JournalType == _expectedJournalType)
{
inventJournalTable.initFromInventJournalName(inventJournalName);
inventJournalTable.VoucherDraw = JournalVoucherDraw::Post;
inventJournalTable.insert();
}
else
{
throw error(strFmt("@SYS22977", _expectedJournalType));
}
return inventJournalTable;
}
}