System Information:
VM Locally hosted -> D365 for Operations, Platform Update 3 Version: 7.0.4307.16141
Requirement:
Create a batch class which system need to run regularly as a batch job.
Issue:
When I click on the Menu item button, I am able to add it to the Batch job bucket (message: The Fetch Data is added to the batch queue.) but it will remain in “waiting” state forever. If run it without batch class logic executed without any issue.
Am I missing anything or doing something wrong? Thanks in Advance.
Task Completed:
- Cross check that server is under the “Selected Server” section of Batch group form ( System administration -> Setup->Batch group), it is showing “Batch: ServerName”
- Create a Class “BatchTest” and extend it from the RunBaseBatch.
- Override the canGoBatch,runsImpersonated, caption, Pack and unpack method.
- Create a method ‘processRecords’which is having actual logic.
- Create Action type menu item with following property set:
- ObjectType - Class
- Object - SysOperationServiceController
- EnumTypeParameter - SysOperationExecutionMode
- EnumParameter - Synchronous
- Parameters - BatchTest.processRecords
Class Code:
class BatchTest extends RunBaseBatch
{
#DEFINE.CurrentVersion(1)
[SysEntryPointAttribute(false)]
public void processRecords()
{
// actuall Logic
}
public container pack()
{
return [#CurrentVersion];
}
public boolean unpack(container packedClass)
{
//Deserializes the packedClass parameter value to an instance of the RunBase class.
boolean isSuccessful;
Version version = RunBase::getVersion(packedClass);
container base;
;
switch (version)
{
case #CurrentVersion:
{
[version, base] = packedClass;
isSuccessful = true;
break;
}
default :
return false;
}
return isSuccessful;
}
public boolean runsImpersonated()
{
return true;
}
public ClassDescription caption()
{
return 'Fetch Data';
}
public boolean canGoBatch()
{
return true;
}
}