
If you want to call a function without opening a dialog, you can use the following example. It’s importand to disabled the use of the last value now, because otherwise there will be no dialog when the user opens the function “normally” by using a menu item.
static void runSysOperationThroughCodeWithoutDialog(Args _args)
{
TutorialSysOperationServiceController controller;
TutorialSysOperationDataContract dataContract;
SysOperationStartResult sysOperationStartResult;
controller = TutorialSysOperationServiceController::newFromArgs(new Args());
// Don't use SysLastValue (so no values will be retrieved and no one will be stored)
controller.parmLoadFromSysLastValue(false);
dataContract = controller.getDataContractObject();
controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);
dataContract.parmFilenameSave(@"c: empmyFile.txt");
// Don't show dialog here
controller.parmShowDialog(false);
//Use this code if your controller doesn't have a service class instantiated
controller.parmClassName(classStr('YOUR SERVICE CLASS'));
//Use this code if your controller doesn't have a service class instantiated
controller.parmMethodName(methodStr('YOUR SERVICE CLASS', 'YOUR SERVICE CLASS METHOD'));
sysOperationStartResult =
controller.startOperation();
}
Leave a comment