JavaScript Application Development API for Oracle Visual Builder Cloud Service - Classic Applications

Class: operation/js/api/OperationResult

Represents result returned from particular Operation.perform(..) method call.

Each Operation.perform(..) method call returns an instance of OperationResult. It either:

  • Provides returned data in case Operation performed correctly.
    It also can contain any other metadata which Business Object Provider decides to return. For example PaginationCursor can be available if the perfomed Operation has type Operation.Type.READ_MANY set and provider implemented capability to paginate through the records.
  • Provides error code, message and possibly any other additional error information in case Operation performed incorrectly.
To check the result of Operation.perform(..) call, you can use:

Version:
  • 17.1.1
Source:
See:

Classes

operation/js/api/OperationResult.Failure
operation/js/api/OperationResult.Success

Methods

isFailure() → {Boolean}

stable API

Checks whether this OperationResult is OperationResult.Failure or not.

Version:
  • 17.1.1
Source:
Returns:

true if this OperationResult is OperationResult.Failure, false otherwise

Type
Boolean
Example

Performs an existing Operation and check the result using OperationResult.isFailure() method.

var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var operation = Abcs.Operations().create({
    entity: employee,
    record: {
        firstName: 'Martin',
        lastName: 'Janicek',
        age: 28
    }
});

operation.perform().then(function(operationResult) {
    // Do something when your operation succeed
}).catch(function(operationResult) {
    if (operationResult.isFailure()) {
        // Insert code you want to perform if record creation failed
    }
});

isSuccess() → {Boolean}

stable API

Checks whether this OperationResult is OperationResult.Success or not.

Version:
  • 17.1.1
Source:
Returns:

true if this OperationResult is OperationResult.Success, false otherwise

Type
Boolean
Example

Performs an existing Operation and check the result using OperationResult.isSuccess() method.

var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var operation = Abcs.Operations().create({
    entity: employee,
    record: {
        firstName: 'Martin',
        lastName: 'Janicek',
        age: 28
    }
});

operation.perform().then(function(operationResult) {
     if (operationResult.isSuccess()) {
         // Insert code you want to perform after record being created
     }
});