Hi Team,
I have created batch job using sysoperation framework with following code
class CG_AGR_AdjustInvoiceTermsController extends SysOperationServiceController
{
}
public void new()
{
super();
this.parmClassName(classStr(CG_AGR_AdjustInvoiceTermsService));
this.parmMethodName(methodStr(CG_AGR_AdjustInvoiceTermsService, upload));
}
public static void main(Args args)
{
CG_AGR_AdjustInvoiceTermsController controller = new CG_AGR_AdjustInvoiceTermsController();
controller.parmDialogCaption("Adjust Invoice Terms");
controller.parmExecutionMode(SysOperationExecutionMode::ScheduledBatch);
controller.startOperation();
}
class CG_AGR_AdjustInvoiceTermsService extends SysOperationServiceBase
{
//To get the path from the dialog
FilePath inputPath;
FilePath failPath;
FilePath processedPath;
//
FileName importFile;
FilePath filePath;
FileName fileNameOnly;
FileNameType fileType;
//For file access & creation
ITP_AsciiIOPerm fileIn;
ITP_AsciiIOPerm fileError;
ITP_AsciiIOPerm fileProcessed;
//Holds the path of the newly created processed and error files
FilePath processedfilePath;
FilePath errorfilePath;
//To hold the values from the input file
IUS_AGR_AgreementId agreementId;
container fileLine;
int failed, total;
#File
}
[SysEntryPointAttribute]
public void upload(CG_AGR_AdjustInvoiceTermsDataContract _contract)
{
container listOfFiles;
int i;
boolean fileExist;
inputPath = _contract.parmInputPath();
failPath = _contract.parmFailPath();
processedPath = _contract.parmProcessedPath();
listOfFiles = this.createListOfFiles();
fileExist = this.validateListOfFiles(listOfFiles);
for (i = 1; i <= conlen(listOfFiles); i++)
{
importFile = conpeek(listOfFiles, i);
[filePath, fileNameOnly, fileType] = fileNameSplit(importFile);
if(!this.adjustInvoiceTerms())
failed++;
total++;
}
if (fileExist)
{
if(failed == 0)
{
info("@IUS37463");
info(strFmt("@IUS4480", total));
}
else
{
warning("@IUS37464");
info(strFmt("@IUS37465", total - failed, total));
info(strFmt("@IUS37466", failed, total));
}
}
}
Requirement: It is always going to be added to the batch task and will run as batch.
Test Cases:
1. When I try to run the controller class from the AOT, it is added to the batch. (Success)
2. When I add it to the batch task and set the parameters, it is not added to the batch instead it starts running. (Failure)
Question: How can I avoid this failed scenario? I tried to clear both client and server cache, still the problem exist.
Note: Its just single AOS system (Development environment)
Thanks in advance