Getting 'Invalid Work Execute Mode' error in Mobile service of WMS in D365

Hi Experts,

I am trying to create a new workflow under Warehouse > WH Inventory > Item Log(my process).

I have added literals 'xxx_MovementJournal' under whsworkactivity and whsworkexecutemode enums. I am using a enum to point steps in my process with four literals.

Here is the class I have written for WHSWorkExecuteDisplay extension class

/// <summary>
/// 
/// </summary>

[WHSWorkExecuteMode(WHSWorkExecuteMode::xxx_MovementJournal)]
class xxx_WHSWorkExecuteDisplayMovementJournal extends WHSWorkExecuteDisplay
{
container displayForm(container _con, str _buttonClicked = '')
{
container ret = conNull();
container con = _con;
pass = WhsrfPassthrough::create(conPeek(_con, #PassthroughInfo));

if(this.hasError(_con))
{
con = conDel(con, #ControlsStart, 1);
}
switch(step)
{
case xxx_MovementJournalStep::ItemId:
ret = this.getItemIdStep(ret);
break;
case xxx_MovementJournalStep::MRP:
ret = this.getMRPStep(con, ret);
break;
case xxx_MovementJournalStep::BatchandTransDate:

break;
case xxx_MovementJournalStep::ProcessData:

break;
default:
break;

}

ret = this.updateModeStepPass(ret, WHSWorkExecuteMode::xxx_MovementJournal, step, pass);

return ret;
}

private container getItemIdStep(container _ret)
{
_ret = this.buildGetItemId(_ret);
_ret += [this.buildControl(#RFButton, #RFOK, '@SYS5473', 1, '', #WHSRFUndefinedDataType, '', 1)];
_ret += [this.buildControl(#RFButton, #RFCancel, '@SYS50163', 1, '', #WHSRFUndefinedDataType, '', 0)];
step = xxx_MovementJournalStep::MRP;
return _ret;
}

private container getMRPStep(container _ret, container _con)
{
container tmpFieldValues;
Map fieldValues;
boolean complete;
InventTable inventTable;

try
{
[_con, tmpFieldValues] = WHSRFControlData::processData(_con, pass);
fieldValues = WhsrfPassthrough::create(tmpFieldValues);
pass = this.combineMaps(pass, fieldValues);

if(this.hasError(_con))
{
return _con;
}
[_ret, complete] = this.processFieldValues(_con, fieldValues);
if(!fieldValues.empty() && pass.exists(#ItemId))
{
InventTable = InventTable::find(pass.lookupStr(#ItemId));
if(InventTable)
{
//_ret = conNull();
_ret = this.BuildMRP(_ret, pass, inventTable);
step = xxx_MovementJournalStep::BatchandTransDate;
}
else
{
_ret = conNull();
_ret = this.addErrorLabel(_ret, 'Invalid ItemId', WHSRFColorText::Error);
_ret = this.getItemIdStep(_ret);
}
}
}
catch
{
_ret = conNull();
_ret = this.addErrorLabelFromInfolog(_ret, infologLine() + 1, WHSRFColorText::Error);
_ret = this.getItemIdStep(_ret);
}
return _ret;
}

private container BuildMRP(container _ret, WhsrfPassthrough _pass, InventTable _inventTable)
{
InventTableModule inventTableModule = InventTableModule::find(_inventTable.ItemId, ModuleInventPurchSales::Sales);

if(_pass.hasValue(#MRP))
{
_ret += [this.buildControl(#RFText, #MRP, "Maximum Retail Price", _pass.lookup(#MRP), '', extendedTypeNum(MaximumRetailPrice_IN), '', 0, 0)];
}
else
{
_ret += [this.buildControl(#RFText, #MRP, "Maximum Retail Price", 1, strFmt('%1', inventTableModule.Price), extendedTypeNum(MaximumRetailPrice_IN), '', 0, 0)];
}

if(_pass.hasValue(#NewMRPMovement))
{
_ret += [this.buildControl(#RFText, #NewMRPMovement, "New Maximum Retail Price", _pass.lookup(#NewMRPMovement), '', extendedTypeNum(MaximumRetailPrice_IN), '', 0, true)];
}
else
{
_ret += [this.buildControl(#RFText, #NewMRPMovement, "New Maximum Retail Price", 1, '', extendedTypeNum(MaximumRetailPrice_IN), '', 0, true)];
}
//_ret += [this.buildControl(#RFLabel, #MRP, strFmt('%1', inventTableModule.Price), 1, '', #WHSRFUndefinedDataType, '', 0, false, "", WHSRFColorText::Default, extendedTypeNum(MaximumRetailPrice_IN))];
//_ret += [this.buildControl(#RFLabel, #NewMRPMovement, '', 1, '', #WHSRFUndefinedDataType, '', 1, false, "", WHSRFColorText::Default, extendedTypeNum(MaximumRetailPrice_IN))];
_ret += [this.buildControl(#RFButton, #RFOK, '@SYS5473', 1, '', #WHSRFUndefinedDataType, '', 1)];
_ret += [this.buildControl(#RFButton, #RFCancel, '@SYS50163', 1, '', #WHSRFUndefinedDataType, '', 0)];
return _ret;
}

}

I haven't completed my 4 steps in the class. But, the button is not even initiating the step 1 itself.

This is how I am getting the error when I click on Item Log(Process 1st step initiation)

Thanks in advance.

Verma.

Related
Recommended