Creating an Operation Record
When you create an Operation record, you can add configured operation parameters if needed. After you define operation parameters, you can configure them at operation design time. A set of operation parameters related to a specified operation is passed as part of the parameter map received by the operation at runtime. You can use configured operation parameters to change parameter values without the need to update operation code. When you create or update operation parameters, changes are automatically reflected by the platform the next time that the operation is executed.
To create an Operation record:
1. In
Max Designer, on the
Developer Tools (
) launchpad menu, click
Operations, and then in the list view, in the top right corner, click
Create (
).
2. Complete the fields as follows, and then in the top left corner, click
Save and Close (
).
Field | Value |
---|
Name | Name for the operation, for example, Shopping Operation. |
Identifier | Unique identifier for the operation. Based on the Name field value. |
Namespace | Namespace of the Max instance, for example, Development – dev. |
Computer Language | Groovy |
Class Name | com.maxservice.operation.ShoppingOperation |
Method Name | execute |
3. Optionally, to add configured operation parameters, in the relevant
Operation record, on the
Operation Parameters tab, in the list, in the top left corner, click
Create (
).
4. In the Create New Operation Parameter dialog box, complete the fields as follows to add as many parameters as needed.
Field | Value |
---|
Name | Name for the parameter. |
Identifier | Unique identifier for the parameter. Auto-populates based on value in Name field. |
Related Operation | Operation to which the parameter is related, for example, Shopping Operation. |
Parameter Datatype | Data type for the parameter, for example, String. |
Parameter Value | Value for the parameter. |
In the Operation record, parameters appear in the Operation Parameters tab. During execution, the operation receives the parameters specified at runtime, plus all configured operation parameters.
Operation Example
To execute an operation and pass only one parameter on the map:
MaxObject item = Database.getByUUID('svmx_shopping_item', UUID.fromString('any-uuid-of-one-shopping-item-record'))
com.servicemax.core.Max.executeOperation("svmx_shopping_operation", [aparam :'avalue', iop_result: [object : item.entity]])
The actual map of parameters received by the shopping operation includes the operation parameters:
def customParams = params['iop_operation_parameters']
[
iop_operation_parameters:[operation_parameter1:hello world, operation_parameter2:100],
aparam:avalue,
.
.
]
For more information: