---
description: >-
  Stores an inventory movement in a table with a certain structure. The Function
  handles database transactions and generates movement ids.
---

# Inventory Movement

Mandatory fields: imItemId, imQuantity

### Example Usages

```javascript
await app.businessFunction({
  functionName: "InventoryMovement",
  movementTable: "inventoryMovement",
  movements: [
    {
      imQuantity: app.getFieldValue("quantityToShip") * -1,
      imAddressId: app.getFieldValue("companyId"),
      imItemId: app.getFieldValue("itemId"),
      imImei: app.getFieldValue("imei"),
    },
    {
      imQuantity: app.getFieldValue("quantityToShip"),
      imAddressId: app.getFieldValue("customerId"),
      imCustomerUserId: app.getFieldValue("customerUserId"),
      imItemId: app.getFieldValue("itemId"),
      imCustomerOrderLineId: app.getFieldValue("orderLineId"),
      imImei: app.getFieldValue("imei"),
    },
  ],
});
```
