Hi,
I have a customized code not made by me that opens a dialog and some logic is done when ok is clicked.
I want to made an extension of this method and put code after super where i don't want their dialog (logic) to wait for my code until it closes.
Which means their dialog must close right after their logic ends and my new logic can run in the background.
I think what I'm trying to achieve means that I need to create a batch with Async right? but I tried to debug and the dialog didn't close directly and the debug went to my controller and waited for it to finish before the dialog was closed
so here's what i did:
[ExtensionOf(classStr(class1))]
final class classAA_Extension
{
protected void method1()
{
next post();
Controller controller = Controller::construct(Id);
controller.startOperation();
}
}
contract
[DataContractAttribute]
class Contract
{
Id id;
[DataMemberAttribute]
public Id Id(Id _id = id)
{
id = _id;
return id;
}
}
Controller
///
///
///
[SysOperationJournaledParameters(true)]
class Controller extends SysOperationServiceController
{
///
/// What method to call from the service class
///
protected void new()
{
super(classStr(Service),methodstr(Service,Demo),SysOperationExecutionMode::Asynchronous);
}
public static Controller construct(Id _Id = "")
{
Controller controller = new Controller();
controller.parmShowDialog(false);
controller.parmShowProgressForm(false);
Contract contract = controller.getDataContractObject();
contract.Id(_Id);
return controller;
}
///
/// main method of the controller class
///
/// args
public static void main(Args _args)
{
Controller controller = Controller::construct();
controller.startOperation();
}
///
/// caption that appears on the dialog
///
/// the caption string
protected ClassDescription defaultCaption()
{
return 'run';
}
}
1. First, i had to pass the Id in the construct method and use this line in the method [Contract contract = controller.getDataContractObject(); to be able to pass the value to the service class, could i have done this in a better way? i don't think i should pass the value in construct or use getDataContract there as well.
Service class
class Service extends SysOperationServiceBase
{
public void Demo(Contract _contract)
{
// logic
}
}
2. How can i make it Async? what did i do wrong?
3. what is the difference between Async and ReliableAsync, which one should i choose?