# Epicor

> Manage customers, parts and sales orders in Epicor Kinetic, run BAQs and Epicor Functions.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/epicor

## Actions

### Add sales order line

Add a part to a sales order.

**Inputs**

- Order number (`order_number`, number, required): The sales order number (OrderNum).
- Part (`part_number`, text, required): The part to order (PartNum).
- Description (`line_description`, text): Line description.
- Quantity (`quantity`, number): Quantity ordered, in the sales unit. At least 0.
- Unit price (`unit_price`, number): Unit price in the order's currency. At least 0.
- Reference (`reference`, text): Your reference for the line.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "Company": "example",
    "DocUnitPrice": 1,
    "LineDesc": "example",
    "OrderLine": 1,
    "OrderNum": 1,
    "PartNum": "example"
  }
}
```

### Create customer

Add a customer. Epicor gives it the next customer number.

**Inputs**

- Customer ID (`customer_id`, text, required): The customer ID people see in Epicor (CustID), such as ACME.
- Name (`name`, text, required): The customer's name.
- Address line 1 (`address_line_1`, text): First address line.
- Address line 2 (`address_line_2`, text): Second address line.
- Address line 3 (`address_line_3`, text): Third address line.
- City (`city`, text): City.
- State (`state`, text): State or province.
- ZIP code (`zip`, text): ZIP or postal code.
- Country (`country`, text): Country, as Epicor names it.
- Territory (`territory`, text): Sales territory ID, such as US MID.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "Address1": "example",
    "City": "example",
    "Company": "example",
    "Country": "example",
    "CustID": "example",
    "CustNum": 1,
    "Name": "example",
    "State": "example",
    "Zip": "example"
  }
}
```

### Create part

Add a part. Units left empty take the company's defaults.

**Inputs**

- Part (`part_number`, text, required): The new part number (PartNum).
- Description (`description`, text, required): The part's description.
- Part type (`part_type`, text): Whether the part is purchased, manufactured or a sales kit. One of: `purchased`, `manufactured`, `sales_kit` (Sales kit). Default: `purchased`.
- Inventory unit (`inventory_uom`, text): Inventory unit of measure (IUM), such as EA.
- Purchasing unit (`purchasing_uom`, text): Purchasing unit of measure (PUM), such as EA.
- Sales unit (`sales_uom`, text): Sales unit of measure, such as EA.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "Company": "example",
    "IUM": "example",
    "PartDescription": "example",
    "PartNum": "example",
    "TypeCode": "example"
  }
}
```

### Create sales order

Start an open sales order for a customer, billed and shipped to that customer. Add lines with Add sales order line.

**Inputs**

- Customer (`customer_number`, number, required): The customer. Their number (CustNum) also works.
- Terms (`terms_code`, text): Payment terms code, such as 1/10. Leave empty for the customer's terms.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "Company": "example",
    "CustNum": 1,
    "OpenOrder": true,
    "OrderDtls": [
      {
        "Company": "example",
        "DocUnitPrice": 1,
        "LineDesc": "example",
        "OrderLine": 1,
        "OrderNum": 1,
        "PartNum": "example"
      }
    ],
    "OrderNum": 1,
    "TermsCode": "example"
  }
}
```

### Delete customer

Delete a customer.

**Inputs**

- Customer (`customer_number`, number, required): The customer. Their number (CustNum) also works.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "CustNum": 1,
    "deleted": true
  }
}
```

### Delete part

Delete a part.

**Inputs**

- Part (`part_number`, text, required): The part number (PartNum).

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "PartNum": "example",
    "deleted": true
  }
}
```

### Delete sales order

Delete a sales order.

**Inputs**

- Order number (`order_number`, number, required): The sales order number (OrderNum).

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "OrderNum": 1,
    "deleted": true
  }
}
```

### Delete sales order line

Delete a line from a sales order.

**Inputs**

- Order number (`order_number`, number, required): The sales order number (OrderNum).
- Line number (`line_number`, number, required): The line's number on the order (OrderLine).

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "OrderLine": 1,
    "OrderNum": 1,
    "deleted": true
  }
}
```

### Get customer

Get a customer's details.

**Inputs**

- Customer (`customer_number`, number, required): The customer. Their number (CustNum) also works.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "Address1": "example",
    "City": "example",
    "Company": "example",
    "Country": "example",
    "CustID": "example",
    "CustNum": 1,
    "Name": "example",
    "State": "example",
    "Zip": "example"
  }
}
```

### Get part

Get a part's details.

**Inputs**

- Part (`part_number`, text, required): The part number (PartNum).

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "Company": "example",
    "IUM": "example",
    "PartDescription": "example",
    "PartNum": "example",
    "TypeCode": "example"
  }
}
```

### Get sales order

Get a sales order, with its lines.

**Inputs**

- Order number (`order_number`, number, required): The sales order number (OrderNum).
- Include lines (`include_lines`, true/false): Include the order's lines. On by default. Default: `true`.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "Company": "example",
    "CustNum": 1,
    "OpenOrder": true,
    "OrderDtls": [
      {
        "Company": "example",
        "DocUnitPrice": 1,
        "LineDesc": "example",
        "OrderLine": 1,
        "OrderNum": 1,
        "PartNum": "example"
      }
    ],
    "OrderNum": 1,
    "TermsCode": "example"
  }
}
```

### List customers

List customers, optionally those whose name contains some text.

**Inputs**

- Name contains (`name_contains`, text): Only customers whose name contains this text.
- Filter (`filter`, text): Advanced: an OData filter such as City eq 'Minneapolis'.
- Fields (`fields`, list): Epicor field names to return, such as CustID and Name. Leave empty for all of them.
- Sort (`order_by`, text): Advanced: an OData sort such as Name desc.
- Max records (`top`, number): Most records to return, up to 1,000. Defaults to 100. From 1 to 1000.
- Skip (`skip`, number): Records to skip, to read the next page. Leave empty for the first page. At least 0.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "count": 1,
    "records": [
      {
        "Address1": "example",
        "City": "example",
        "Company": "example",
        "Country": "example",
        "CustID": "example",
        "CustNum": 1,
        "Name": "example",
        "State": "example",
        "Zip": "example"
      }
    ]
  }
}
```

### List parts

List parts, optionally those whose description contains some text.

**Inputs**

- Description contains (`description_contains`, text): Only parts whose description contains this text.
- Filter (`filter`, text): Advanced: an OData filter such as City eq 'Minneapolis'.
- Fields (`fields`, list): Epicor field names to return, such as CustID and Name. Leave empty for all of them.
- Sort (`order_by`, text): Advanced: an OData sort such as Name desc.
- Max records (`top`, number): Most records to return, up to 1,000. Defaults to 100. From 1 to 1000.
- Skip (`skip`, number): Records to skip, to read the next page. Leave empty for the first page. At least 0.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "count": 1,
    "records": [
      {
        "Company": "example",
        "IUM": "example",
        "PartDescription": "example",
        "PartNum": "example",
        "TypeCode": "example"
      }
    ]
  }
}
```

### List sales order lines

List the lines of a sales order.

**Inputs**

- Order number (`order_number`, number, required): The sales order number (OrderNum).

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "count": 1,
    "records": [
      {
        "Company": "example",
        "DocUnitPrice": 1,
        "LineDesc": "example",
        "OrderLine": 1,
        "OrderNum": 1,
        "PartNum": "example"
      }
    ]
  }
}
```

### List sales orders

List sales orders, newest first, optionally for one customer or only open ones.

**Inputs**

- Customer (`customer_number`, number): Only this customer's orders.
- Open orders only (`open_only`, true/false): Only orders that are still open.
- Filter (`filter`, text): Advanced: an OData filter such as City eq 'Minneapolis'.
- Fields (`fields`, list): Epicor field names to return, such as CustID and Name. Leave empty for all of them.
- Sort (`order_by`, text): Advanced: an OData sort such as Name desc.
- Max records (`top`, number): Most records to return, up to 1,000. Defaults to 100. From 1 to 1000.
- Skip (`skip`, number): Records to skip, to read the next page. Leave empty for the first page. At least 0.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "count": 1,
    "records": [
      {
        "Company": "example",
        "CustNum": 1,
        "OpenOrder": true,
        "OrderDtls": [
          {
            "Company": "example",
            "DocUnitPrice": 1,
            "LineDesc": "example",
            "OrderLine": 1,
            "OrderNum": 1,
            "PartNum": "example"
          }
        ],
        "OrderNum": 1,
        "TermsCode": "example"
      }
    ]
  }
}
```

### Run BAQ

Run a business activity query (BAQ) and get its rows. The BAQ must be in your API key's access scope.

**Inputs**

- BAQ ID (`baq_id`, text, required): The BAQ's ID, such as zCustomer01.
- Filter (`filter`, text): Advanced: an OData filter such as City eq 'Minneapolis'.
- Max records (`top`, number): Most records to return, up to 1,000. Defaults to 100. From 1 to 1000.
- Skip (`skip`, number): Records to skip, to read the next page. Leave empty for the first page. At least 0.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "count": 1,
    "records": [
      {}
    ]
  }
}
```

### Run Epicor Function

Run a published Epicor Function and get its output parameters.

**Inputs**

- Library (`library`, text, required): The function library's ID.
- Function (`function`, text, required): The function's ID.
- Inputs (`inputs`, object): The function's input parameters and their values.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "outputs": {}
  }
}
```

### Update customer

Change a customer's details. Fields left empty keep their value.

**Inputs**

- Customer (`customer_number`, number, required): The customer. Their number (CustNum) also works.
- Customer ID (`customer_id`, text): A new customer ID (CustID).
- Name (`name`, text): The customer's name.
- Address line 1 (`address_line_1`, text): First address line.
- Address line 2 (`address_line_2`, text): Second address line.
- Address line 3 (`address_line_3`, text): Third address line.
- City (`city`, text): City.
- State (`state`, text): State or province.
- ZIP code (`zip`, text): ZIP or postal code.
- Country (`country`, text): Country, as Epicor names it.
- Territory (`territory`, text): Sales territory ID, such as US MID.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "Address1": "example",
    "City": "example",
    "Company": "example",
    "Country": "example",
    "CustID": "example",
    "CustNum": 1,
    "Name": "example",
    "State": "example",
    "Zip": "example"
  }
}
```

### Update part

Change a part's details. Fields left empty keep their value.

**Inputs**

- Part (`part_number`, text, required): The part number (PartNum).
- Description (`description`, text): A new description.
- Part type (`part_type`, text): Whether the part is purchased, manufactured or a sales kit. One of: `purchased`, `manufactured`, `sales_kit` (Sales kit).
- Inventory unit (`inventory_uom`, text): Inventory unit of measure (IUM), such as EA.
- Purchasing unit (`purchasing_uom`, text): Purchasing unit of measure (PUM), such as EA.
- Sales unit (`sales_uom`, text): Sales unit of measure, such as EA.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "Company": "example",
    "IUM": "example",
    "PartDescription": "example",
    "PartNum": "example",
    "TypeCode": "example"
  }
}
```

### Update sales order line

Change a sales order line. Fields left empty keep their value.

**Inputs**

- Order number (`order_number`, number, required): The sales order number (OrderNum).
- Line number (`line_number`, number, required): The line's number on the order (OrderLine).
- Description (`line_description`, text): Line description.
- Quantity (`quantity`, number): Quantity ordered, in the sales unit. At least 0.
- Unit price (`unit_price`, number): Unit price in the order's currency. At least 0.
- Reference (`reference`, text): Your reference for the line.

**Outputs**

- `data` (object): The response from Epicor.

**Example output**

```json
{
  "data": {
    "Company": "example",
    "DocUnitPrice": 1,
    "LineDesc": "example",
    "OrderLine": 1,
    "OrderNum": 1,
    "PartNum": "example"
  }
}
```
