Domain 4 β€” Module 5 of 6 83%
15 of 28 overall
Domain 4: Develop and Test Code Free ⏱ ~15 min read

Frameworks: SysOperation & Workflows

SysOperation for batch processing and workflows for business approvals β€” the two essential F&O frameworks.

Frameworks: SysOperation & Workflows

Simple explanation

SysOperation is a restaurant kitchen. The Controller is the head chef (decides when to cook). The Contract is the order ticket (parameters). The Service is the line cook (does the work). Workflows are approval forms passed desk to desk β€” requester to manager to finance.

SysOperation β€” Controller + Contract + Service

Contract

[DataContractAttribute]
public class CustReportContract
{
    private CustGroupId custGroup;
    private FromDate fromDate;

    [DataMemberAttribute, SysOperationLabelAttribute("Customer group")]
    public CustGroupId parmCustGroup(CustGroupId _v = custGroup) { custGroup = _v; return custGroup; }

    [DataMemberAttribute, SysOperationLabelAttribute("From date")]
    public FromDate parmFromDate(FromDate _v = fromDate) { fromDate = _v; return fromDate; }
}

Service

public class CustReportService
{
    [SysEntryPointAttribute(true)]
    public void generate(CustReportContract _contract)
    {
        CustTable ct;
        while select ct where ct.CustGroup == _contract.parmCustGroup()
        {
            info(strFmt("Customer: %1", ct.Name));
        }
    }
}

Controller

public class CustReportController extends SysOperationServiceController
{
    public void new()
    {
        super();
        this.parmClassName(classStr(CustReportService));
        this.parmMethodName(methodStr(CustReportService, generate));
    }

    public static void main(Args _args)
    {
        CustReportController c = new CustReportController();
        c.parmArgs(_args);
        c.startOperation();
    }
}

The dialog is auto-generated from the contract. Add a parm method = dialog gets a new field.

SysOperation vs RunBase
SysOperation (Modern)RunBase (Legacy)
ArchitectureController + Contract + ServiceSingle monolithic class
ParametersData contracts (auto-serialized)Manual pack/unpack
DialogAuto-generatedManually built
TestabilityService independently testableTightly coupled
Use for new codeAlwaysNever

πŸ‘¨β€πŸ’» Elena: β€œEvery batch job at PacificForge uses SysOperation. The auto-dialog alone saves hours.”

Exam tip: SysOperation is the modern pattern

If the exam asks about batch functionality, answer SysOperation unless RunBase is explicitly mentioned. RunBase is legacy β€” never use for new development.

Workflow Framework

ComponentPurpose
Workflow typeOverall structure for a document
CategoryGroups related workflow types
Approval elementApprove/reject step
Task elementComplete-a-task step
ConditionBranch routing logic
Document classExposes fields for conditions
Event handlersReact to state changes

Document class

[WorkflowDocumentAttribute(tableStr(PurchReqTable))]
public class PurchReqDocument extends WorkflowDocument
{
    public Amount parmTotalAmount()
    {
        return this.getTable().calculateTotalAmount();
    }
}

Event handler

public class PurchReqWFHandler implements WorkflowStartedEventHandler, WorkflowCompletedEventHandler
{
    public void started(WorkflowEventArgs _args)
    {
        PurchReqTable pr = PurchReqTable::find(_args.parmWorkflowContext().parmRecId());
        pr.updateStatus(PurchReqStatus::InReview);
    }
    public void completed(WorkflowEventArgs _args)
    {
        PurchReqTable pr = PurchReqTable::find(_args.parmWorkflowContext().parmRecId());
        pr.updateStatus(PurchReqStatus::Approved);
    }
}

SysExtensionSerializer

Enables extensible enums β€” ISVs can add enum values without modifying the base definition. The framework discovers new values at runtime.

Question

Three SysOperation components?

Click or press Enter to reveal answer

Answer

Controller (orchestration), Contract (parameters via DataContract), Service (business logic via SysEntryPoint).

Click to flip back

Question

SysOperation vs RunBase?

Click or press Enter to reveal answer

Answer

SysOperation separates concerns, auto-serializes, auto-generates dialogs. RunBase is monolithic legacy.

Click to flip back

Question

Workflow document class purpose?

Click or press Enter to reveal answer

Answer

Exposes calculated fields for workflow conditions. E.g., total amount for routing high-value orders.

Click to flip back

Knowledge Check

Sophie needs a batch job with date range parameters. Framework?

Knowledge Check

Where is the total amount calculation for workflow routing?


Next up: Testing: SysTest & Task Recorder