How to create Extension of Batch job class in D365 FO x++
[ExtensionOf(classStr(DSProcessNotificationsBatch))]
final class DSProcessNotificationsBatch_Timesheet_Extension
{
public DialogField dfProcessAbsent;
public DialogField dfProcessInvalidAttendance;
public DialogField dfProcessLeave;
public DSTSProcessAbsent ProcessAbsent;
public DSTSProcessInvalidAttendance ProcessInvalidAttendance;
public DSTSProcessLeave ProcessLeave;
#define.CurrentVersion(4)
#localmacro.CurrentList
ProcessAbsent,
ProcessInvalidAttendance,
ProcessLeave
#endmacro
Public Object dialog()
{
DialogRunbase dialog = next dialog();
dfProcessAbsent = dialog.addFieldValue(extendedTypeStr(DSTSProcessAbsent), ProcessAbsent);
dfProcessInvalidAttendance = dialog.addFieldValue(extendedTypeStr(DSTSProcessInvalidAttendance), ProcessInvalidAttendance);
dfProcessLeave = dialog.addFieldValue(extendedTypeStr(DSTSProcessLeave), ProcessLeave);
return dialog;
}
public boolean getFromDialog()
{
ProcessAbsent = dfProcessAbsent.value();
ProcessInvalidAttendance = dfProcessInvalidAttendance.value();
ProcessLeave = dfProcessLeave.value();
return next getFromDialog();
}
public DSProcessNotifications getProcessNotificationObject()
{
DSProcessNotifications processNotifications;
processNotifications = next getProcessNotificationObject();
processNotifications.parmProcessAbsent(ProcessAbsent);
processNotifications.parmProcessInvalidAttendance(ProcessInvalidAttendance);
processNotifications.parmProcessLeave(ProcessLeave);
return processNotifications;
}
public container pack()
{
container packedClass = next pack();
return SysPackExtensions::appendExtension(packedClass, classStr(DSProcessNotificationsBatch_Timesheet_Extension), this.myPack());
}
private container myPack()
{
return [#CurrentVersion, #CurrentList];
}
public boolean unpack(container _packedClass)
{
boolean result = next unpack(_packedClass);
if (result)
{
container myState = SysPackExtensions::findExtension(_packedClass, classStr(DSProcessNotificationsBatch_Timesheet_Extension));
//Also unpack the extension
if (!this.myUnpack(myState))
{
result = false;
}
}
return result;
}
private boolean myUnpack(container packedClass)
{
Integer version = RunBase::getVersion(packedClass);
switch (version)
{
case #CurrentVersion:
[version, #currentList] = packedClass;
break;
default:
return false;
}
return true;
}
}
Comments
Post a Comment