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.
- OperationResult.isSuccess() to check if the call was performed correctly and resulted in a OperationResult.Success.
- OperationResult.isFailure() to check if the call was performed incorrectly and resulted in a OperationResult.Failure.
- Version:
- 17.1.1
- Source:
- See:
Classes
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
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
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
}
});