Skip to main content

Creating Tutorial.ExampleOperation

Here are the steps for creating Tutorial.ExampleOperation using VS Code - ObjectScript:

  1. If you haven't already, within the source code folder in your workspace (probably named src), add a new folder named Tutorial.

  2. Within the Tutorial folder, add a new file named ExampleOperation.cls.

  3. Enter the following code:

    
    Class Tutorial.ExampleOperation extends Ens.BusinessOperation {
    
    Parameter INVOCATION = "Queue";
    
    Method Test(pRequest As Ens.StringRequest, Output pResponse As Ens.StringResponse) As %Status
    {
     Set pResponse=##class(Ens.StringResponse).%New()
     if (pRequest.StringValue="")
     {
       Set pResponse.StringValue="ERROR"
       Set tSC=$$$ERROR($$$GeneralError, "Test error case")
     }
     else
     {
       Set pResponse.StringValue="OK"
       Set tSC=$$$OK
     }
     $$$LOGINFO(pResponse.StringValue)
     Return tSC
     }
    }
    
    XData MessageMap {
    <MapItems>
        <MapItem MessageType="Ens.StringRequest">
            <Method>Test</Method>
        </MapItem>
    </MapItems>
    }
    
    }
    
    
FeedbackOpens in a new tab