# GET Operation with status PENDING or EXECUTING

**URL:** https://community.cumulocity.com/t/get-operation-with-status-pending-or-executing/3295
**Category:** Forum
**Tags:** c8y-webSDK, cumulocity
**Created:** [December 16, 2022, 6:51pm UTC](https://community.cumulocity.com/t/get-operation-with-status-pending-or-executing/3295 "2022-12-16T18:51:53Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![Nick\_Ponomar1](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/nick_ponomar1/32/2892_2.png) [@Nick\_Ponomar1](https://community.cumulocity.com/u/Nick_Ponomar1)
#### Post date: [December 22, 2022, 1:32pm UTC](https://community.cumulocity.com/t/get-operation-with-status-pending-or-executing/3295/6 "2022-12-22T13:32:42Z")

</div>

There is another way to get that resolved with a revert parameter. General guideline from Cumulocity is that all operations has to be executed in order created on the platform. So getting one or a couple of latest operations works. Here is a code snippet for it:

```auto
const filter: object = {
      deviceId: this.moId,
      fragmentType: 'custom_type',
      dateFrom: '1990-01-01',
      revert: true,
      pageSize: 1
    };
    const op: IOperation | undefined = (await this.operationService.list(filter)).data[0];
    if (op && (op.status == OperationStatus.EXECUTING || op.status == OperationStatus.PENDING)) {
      // business login goes here
    }

```

This will return a list of at most one operation with the newest operation of the specified type for the specified device. If it is in status PENDING or EXECUTING then there is an operation, if it doesn’t exists or if it is in status SUCCESSFUL or FAILED then there is no ongoing operation. This works for single devices because devices are responsible to execute operations in order.

---

_[View the full topic](https://community.cumulocity.com/t/get-operation-with-status-pending-or-executing/3295)._
