0% found this document useful (0 votes)
28 views

Implement The SysOperation Framework

The document discusses implementing the SysOperation framework and SysExtensionSerializer framework. SysOperation provides more extensibility than the older RunBase framework and supports parameters, UI, batch servers, and interactive operations. It consists of a data contract class, controller class, service class, and optional UI builder class. The SysExtensionSerializer framework automates CRUD operations for custom tables related to standard tables through extension mapping.

Uploaded by

Shaik Abdulla
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Implement The SysOperation Framework

The document discusses implementing the SysOperation framework and SysExtensionSerializer framework. SysOperation provides more extensibility than the older RunBase framework and supports parameters, UI, batch servers, and interactive operations. It consists of a data contract class, controller class, service class, and optional UI builder class. The SysExtensionSerializer framework automates CRUD operations for custom tables related to standard tables through extension mapping.

Uploaded by

Shaik Abdulla
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Implement the SysOperation framework

The SysOperation framework replaces the older RunBase framework, and it provides
more extensibility. Both frameworks support the following capabilities:

 Parameters
 Dialog user interface (UI)
 Batch servers
 Running operations interactively

For finance and operations apps, we recommend that you use the SysOperation
framework instead of the RunBase framework. Use SysOperation framework when a
job should process or calculate something.

SysOperation consists of four main elements:

 Data contract class


 Controller class
 Service classUI
 Builder class

Data contract class

The Data contract class indicates the attributes that are needed for the job, and the
attributes automatically provide a dialog-based UI. The following code sample
illustrates the Data contract class:

X++Copy
[DataContractAttribute]
internal final class MySysOperationContract
{
private ItemId itemId;

[DataMember, SysOperationLabel(literalStr("Item Id")),


SysOperationHelpText(literalStr("Item Id help")), SysOperationDisplayOrder('1')]
public ItemId parmItemId(ItemId _itemId = itemId)
{
itemId = _itemId;

return itemId;
}
}
Controller class

The Controller class is the execution class, which contains information about the
dialog, execution mode, progress bar, and other elements. The following code
sample illustrates the Controller class:

X++Copy
internal final class MySysOperationController extends
SysOperationServiceController
{
protected void new()
{
super(classStr(mySysOperationService), methodStr(MySysOperationService,
process), SysOperationExecutionMode::Synchronous);
}

public ClassDescription defaultCaption()


{
return "My process job";
}

public static MySysOperationController construct(SysOperationExecutionMode


_executionMode = SysOperationExecutionMode::Synchronous)
{
MySysOperationController controller;
controller = new MySysOperationController();
controller.parmExecutionMode(_executionMode);

return controller;
}

public static void main(Args _args)


{
MySysOperationController controller;

controller = MySysOperationController::construct();
controller.parmArgs(_args);
controller.startOperation();
}
}

Service class

The Service class is the actual code that's processed or calculated. The following
sample code illustrates the Service class:

X++Copy
internal final class MySysOperationService extends SysOperationServiceBase
{
public void process(MySysOperationContract _contract)
{
// do something

ItemId itemId = _contract.parmItemId();


Info(strFmt("%1", itemId));
}
}

UI Builder class

The UI Builder class is only needed if the UI requires modification from the
dynamically generated UI or if it has custom behavior.

Implement the SysExtensionSerializer


You can add fields to a table by using an extension. If you're adding more than 10
fields to a table extension, the compiler throws the best practice error. We
recommend that you use the alternative way of creating a new table and adding a
foreign key relation to the standard table. Maps are available to help you improve a
developer’s processes.
The SysExtensionSerializerMap and SysExtensionSerializerExtensionMap maps
make the create, read, update, and delete (CRUD) operations automated to the
custom table.

You can create a new table for your new fields, as the following image depicts.

Consider the following details about implementing


the SysExtensionSerializer extension:

 The CustTable field is an int64 (RecId).


 It creates relation to the CustTable standard table and points to RecId on
CustTable, as the following screenshot shows.

 It creates mapping to map


the SysExtensionSerializerExtensionMap field BaseRecId to a new table
called MyCustTable and the CustTable field.
 It creates an alternate key (Index) on the table for the CustTable field in
the MyCustTable table. For the table property, the Replacement Key is set to
the Alternate key, as the following screenshot shows.
The SysExtensionSerializerMap contains methods for automatically inserting,
updating, and performing many other functions. The standard CustTable table
includes calls to the SysExtensionSerializer framework, which means that whenever
a record in CustTable is updated, your table is also updated, as the following
screenshot shows.
Using the SysExtensionSerializer framework fields helps you add a related table by
following best practices and enabling CRUD functionality.

You might also like