---
title: "Advanced Technical Example : Using Shop Floor Insight web services for custom user interfaces"
app: "Shop Floor Insight"
section: "Set up"
last_updated: "2026-11-05"
url: "https://insight-works.com/kb/shop-floor-insight/advanced-technical-example-using-shop-floor-insight-web-services-custom-user-interfaces/"
---

# Advanced Technical Example : Using Shop Floor Insight web services for custom user interfaces

This article shows how a custom application can use OAuth to call Shop Floor Insight web services directly in Business Central. The examples cover employee sign-in and end of shift, production dispatch data, starting and stopping production time, time card inquiries, work instructions, production components, and recording tracked output and consumption.

The requests go directly to Business Central. They can be used by a custom application without calling the Shop Floor Insight Windows service or portal.

The web service examples are intended for developers building their own shop floor interface on top of Shop Floor Insight in Business Central.

Use these examples when you need a custom application, kiosk, or production interface and have chosen to develop and maintain the user experience yourself. Your application calls Business Central directly to perform activities such as employee sign-in, production clock-on and clock-off, dispatch inquiries, displaying work instructions and components, and recording output or consumption.

Do not use this guide if you are extending any of the existing interfaces.

Also consider this other guide that walks through integration using a c# example : [https://kb.dmsiworks.com/knowledge-base/advanced-technical-example-scan-shop-floor-insight-barcodes-from-a-c-windows-application/](/kb/shop-floor-insight/advanced-technical-example-scan-shop-floor-insight-barcodes-from-a-c-windows-application/)

## Consider the Existing Interfaces First

Before developing a custom user interface, consider whether one of the existing options meets your requirements:

- **Shop Floor Insight’s barcode-optimized interface:** Use the existing shop floor interface for barcode-driven employee sign-in, production time collection, and related shop floor activities.
- **Warehouse Insight with Shop Floor Insight:** Use the Shop Floor Insight integration within Warehouse Insight when operators need access to production activities from supported warehouse devices. See [Warehouse Insight Shop Floor Integration](/kb/warehouse-insight/warehouse-insight-shop-floor-integration/).
- **Business Central phone/tablet interface:** Use Shop Floor Insight’s native mobile interface through the Business Central phone/tablet app and the appropriate Shop Floor role center. See [Shop Floor Native Phone Client](/kb/shop-floor-insight/shop-floor-insight-shop-floor-native-phone-client/).
- **Business Central directly:** Use the available Shop Floor Insight and Business Central pages when employees or supervisors can perform their work within Business Central.

These options provide existing interfaces and workflows that may avoid the need to build and maintain a separate application. Available functionality differs between interfaces, so evaluate the activities your operators need.

## Device Licensing

A custom interface does not remove Microsoft’s Business Central licensing requirements. Business Central Device licenses can cover qualifying shared shop floor devices used by multiple employees, but provide limited use rights rather than full Business Central access. Confirm the appropriate user or device licensing with your Microsoft partner, including access through web services. See Microsoft’s [Business Central device licensing information](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/deployment/licensing#device-licenses) and [Business Central licensing guidance](https://www.microsoft.com/licensing/guidance/Dynamics-365-Business-Central).

## Before You Begin

You should be familiar with Business Central web services, production orders, the output and consumption journals, and how production order components are used. Your production processes should be finalized and working in Business Central, and you should be able to successfully post output and consumption against a production order before developing a custom interface. You should also have a basic understanding of Shop Floor Insight’s out-of-the-box capabilities and configuration options. For an overview and demonstration, watch [Optimizing MES: Shop Floor Insight for Dynamics 365 Business Central](https://dmsiworks.com/webcasts/optimizing-mes-shop-floor-insight-for-dynamics-365-business-central).

## Example values and where to get them

The values below are illustrative. Replace them with values from your Business Central company; the example barcodes do not identify the same records in every company.

| Example value | Meaning and how to obtain it |
| --- | --- |
| `/R00000001%` | Employee/resource badge barcode. Run **Shop Floor Employee Badges** for the employee and scan the ordinary employee badge into a text field to obtain its raw value. Use the sign-in badge rather than a break badge. |
| `/O00000001%` | Run-time barcode for a production routing operation. Run **Shop Floor Production Order** for the production order and scan the required operation’s run-time barcode. |
| `/N00000001%` | Setup-time barcode from the same production order report. Use this when recording setup rather than run time. |
| `192.168.123.45` | Example terminal IP address. Use the address of the terminal making the request, consistent with your client configuration rules. |
| `CFG000001` | Client configuration number. Find it on **Shop Floor Client Configurations**; after sign-in, use the returned `Client_Config_No`. |
| `EMP001`, `TC000123` | Employee number and time card number returned by sign-in. The employee number and its scanned badge barcode are different values. |
| `RPO00123`, `10000`, `20` | Production order number, production order line number, and operation number. Obtain them from the selected dispatch row or production time card line as shown in the examples. |
| `20000` | Production component line number returned by the BOM service. It is separate from the production order line number and time card line number. |
| `MAIN`, `CONS001` | Example location and consumption journal batch. Use the actual production/component location and the **Consumption Batch Name** on the effective client configuration. |
| `LOT-001`, `SN-001`, `COMP-SN` | Example lot number, serial number, and serial-tracked component item. Use your actual production lot and the selected component’s item and available serial number. |
| `CRONUS Canada, Inc.` | Example company name. Use the company containing your Shop Floor Insight setup and production orders. |

Scan barcodes into a plain text field to capture the complete value, including `/` and `%` when present. Use the scanned value rather than barcode-font start/stop characters such as surrounding `*` characters. Your configured barcode format may differ. When placing the value in a URL, encode it: for example, `/R00000001%` becomes `%2FR00000001%25` within the encoded filter value.

## Prerequisites

Run the **Shop Floor Insight Setup Wizard** to install and publish the Shop Floor Insight web services. The services used in these examples are:

| Service name | Object type | Object ID | Used for |
| --- | --- | --- | --- |
| `TCMServerBarcode` | Page | 23044138 | Employee barcode sign-in, routing barcode scans, and clock actions. |
| `TCMDispatch` | Page | 23044214 | Production dispatch data for a client configuration and employee. |
| `TCMTimeCardLine` | Page | 23044212 | Reading time card lines. |
| `TCMTimeCardHeader` | Codeunit | 23044202 | Calculating time card and weekly totals. |
| `TCMWorkInstructionsRouting` | Page | 23044219 | Work instructions for a production operation. |
| `TCMBom` | Page | 23044217 | Production order component/BOM information. |
| `TCMOutputMgmt` | Codeunit | 23044212 | Recording production output. |
| `TCMConsumptionMgmt` | Codeunit | 23044210 | Recording production consumption. |

If a service is unavailable, check its name, object type, object ID, and **Published** setting on the Business Central **Web Services** page.

For the action examples:

- Use a valid Shop Floor Client Configuration with the required activity defaults and time settings. The automatic barcode clock-on/off examples use **Time Entry Mode** of **Auto** or **Auto – Same Entry Only**.
- Use employee and routing barcodes generated in the Business Central company being accessed. A barcode is not necessarily the same as an employee number or production order number.
- Configure OAuth access and the Business Central permissions needed for the operations. The OAuth identity connects the application to Business Central; the employee barcode identifies the Shop Floor Employee within that connection.

The examples describe standard behavior. Configured workflows and customizations can require additional interaction or affect the outcome.

## Request conventions

The requests use `BASE_URL` as shorthand for the Business Central OData V4 base URL. For example:

```
https://api.businesscentral.dynamics.com/v2.0/11111111-2222-3333-4444-555555555555/Sandbox/ODataV4
```

Replace the example tenant ID with your Microsoft Entra tenant ID and `Sandbox` with your environment name. Use your company name in place of `CRONUS Canada, Inc.`. For on-premises deployments, use the published OData V4 base URL for that deployment, including any required tenant parameters. `BASE_URL` is an abbreviation in this article, not text to send as the host name.

Send these headers with each request:

```
Authorization: Bearer {access_token}
Accept: application/json
```

Replace `{access_token}` with an OAuth access token acquired by your application; the article does not include a reusable sample token. For JSON POST requests, also send `Content-Type: application/json`.

The examples show filters on separate lines for readability. Build one request URL and URL-encode the query values before sending it. Escape apostrophes in OData string literals by doubling them. Omit unused input fields. Check `BASE_URL/$metadata` for the property names and action parameters available in your environment.

For OAuth configuration, see Microsoft’s [Business Central OAuth guidance](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/webservices/authenticate-web-services-using-oauth). Unattended applications can use [service-to-service authentication](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/automation-apis-using-s2s-authentication).

**Important:** `TCMServerBarcode` accepts its inputs through GET request filters, but these requests can change time cards. Do not cache, prefetch, or automatically retry them. If a request times out, read the time card to determine the outcome before submitting another action. Repeating a routing scan can stop time that the first request started.

## Example 1: Sign in using an employee barcode

Submit the employee barcode with the `LOGIN` context:

```
GET BASE_URL/Company('CRONUS Canada, Inc.')/TCMServerBarcode?$filter=
  Input_Action_Type_Code eq 'BARCODE.SCAN' and
  Input_Action_Data eq '/R00000001%' and
  Input_Config_No eq 'CFG000001' and
  Input_Screen_Code eq 'LOGIN' and
  Input_Address eq '192.168.123.45'
```

`Input_Address` identifies the terminal address, such as its IP address, and can be used when resolving the client configuration. It is not an authentication credential.

`Input_Config_No` can be omitted when the configuration should be resolved from the configured employee/address rules. Even when a configuration is supplied, use the configuration returned by sign-in for subsequent requests.

For this initial sign-in, omit the employee number, time card number, and selected-row keys. The employee barcode supplies the employee identity.

The response contains an ordered list of instructions. Reconstruct any chunked data as described under **Handling action responses** below. A normal successful individual sign-in includes `RESP.SIGNIN`. Its `Response_Data` contains JSON with values such as:

```
{
  "Time_Card_Header_No": "TC000123",
  "Employee_No": "EMP001",
  "Employee_Name": "Example Employee",
  "Client_Config_No": "CFG000001"
}
```

This is an illustrative subset of the reconstructed payload. It also includes login information and client configuration data. The `Client_Config` property contains configuration details as an encoded JSON string.

Retain these returned values:

| Returned property | Use in later requests |
| --- | --- |
| `Employee_No` | Employee context for dispatch queries and clock actions. |
| `Time_Card_Header_No` | Current time card for clock actions and reading recorded time. |
| `Client_Config_No` | Effective client configuration for dispatch queries and clock actions. |

Sign-in places the employee on site and obtains an appropriate time card, creating one when required by the configured rules. It does not, by itself, start production time on a routing operation. Sign-in is a state-changing operation, not a read-only employee lookup.

The remaining examples use `EMP001`, `TC000123`, and `CFG000001` to represent these returned values. Replace them with the actual response values.

## Example 2: Display the production dispatch list for the employee

Use the employee and client configuration returned by sign-in:

```
GET BASE_URL/Company('CRONUS Canada, Inc.')/TCMDispatch?$filter=
  Config eq 'CFG000001' and
  Assigned_To_No eq 'EMP001'
```

The input names on the dispatch service differ from those on the action service:

| Dispatch input | Value |
| --- | --- |
| `Config` | `Client_Config_No` returned by sign-in. |
| `Assigned_To_No` | `Employee_No` returned by sign-in. |

The response is an OData object with a `value` array of dispatch rows. For example, a row can contain:

```
{
  "Prod_Order_No": "RPO00123",
  "Prod_Order_Line_No": 10000,
  "Operation_No": "20",
  "Description": "Assembly",
  "Work_Center_No": "ASSEMBLY",
  "Am_I_Clocked_On": false
}
```

This is an illustrative subset. Other properties include routing status, item details, assignment details, and scheduled dates.

The returned list applies the dispatch settings from **Shop Floor Setup**, the client configuration, and any other configured dispatch filters. In particular, **Dispatch Employee Filtering** controls how the supplied employee is used:

| Setting | Assignment filter applied |
| --- | --- |
| **Do Not Filter** | Does not restrict the list by employee assignment. |
| **Current User** | Uses the supplied employee number for assignment filtering. |
| **Unassigned** | Shows unassigned work. |
| **Unassigned or Current User** | Shows unassigned work and work assigned to the supplied employee. |

Therefore, `Assigned_To_No` supplies the employee context; it does not always mean “return only this employee’s assignments.” It is also used to calculate `Am_I_Clocked_On` for the operation. Assignment and clocked-on status are different concepts.

Date filters, production custom filters, and **Dispatch Row Limit** can further restrict the results. An empty response does not necessarily mean that no production routing lines exist. This endpoint returns the configured dispatch list, rather than an unrestricted export of all routing lines.

## Example 3: Start time on a selected dispatch row

After the employee selects an operation from Example 2, submit a `ClockOn` action using the same employee, time card, and client configuration:

```
GET BASE_URL/Company('CRONUS Canada, Inc.')/TCMServerBarcode?$filter=
  Input_Action_Type_Code eq 'MENUITEM' and
  Input_Action_Data eq 'ClockOn' and
  Input_Config_No eq 'CFG000001' and
  Input_Employee_No eq 'EMP001' and
  Input_Time_Card_No eq 'TC000123' and
  Input_Screen_Code eq 'PROD_ORDER' and
  Input_Address eq '192.168.123.45' and
  Selected_Row_Key_1 eq 'RPO00123' and
  Selected_Row_Key_2 eq '10000' and
  Selected_Row_Key_3 eq '20'
```

Map the selected dispatch row to the action inputs as follows:

| Action input | Dispatch row property |
| --- | --- |
| `Selected_Row_Key_1` | `Prod_Order_No` |
| `Selected_Row_Key_2` | `Prod_Order_Line_No`, converted to a string. |
| `Selected_Row_Key_3` | `Operation_No` |

Use **`Prod_Order_Line_No`**, not `Routing_Reference_No`, for key 2. Keep all three keys so the request identifies the selected production order line and operation.  Routing Reference No. and Prod. Order Line No. are not the same in Business Central, this discrepancy is just a legacy restriction from earlier versions of the product.

`PROD_ORDER` tells the service that the selection represents a production dispatch row. It is required context even when the custom application does not display a screen with that name. No routing barcode is required for this example.

This action creates the applicable run-time entry for the selected operation, using the employee and client configuration defaults. Depending on **Time Entry Mode**, starting another operation can also stop an existing entry. Process the response instructions, then read the time card to confirm the result.

`ClockOn` is an explicit start action; do not assume it toggles an existing entry off or that repeated requests are harmless. Check the existing clock state before offering another start action. For setup time, use the appropriate setup routing barcode as described in Example 4.

## Example 4: Start and stop time using a routing barcode

As an alternative to selecting a dispatch row, scan a production order routing barcode:

```
GET BASE_URL/Company('CRONUS Canada, Inc.')/TCMServerBarcode?$filter=
  Input_Action_Type_Code eq 'BARCODE.SCAN' and
  Input_Action_Data eq '/O00000001%' and
  Input_Config_No eq 'CFG000001' and
  Input_Employee_No eq 'EMP001' and
  Input_Time_Card_No eq 'TC000123' and
  Input_Screen_Code eq 'TIME_CARD' and
  Input_Address eq '192.168.123.45'
```

For a scan without a selected time card line, omit the selected-row keys.

| Current state | Standard scan behavior |
| --- | --- |
| No matching open entry | Creates the applicable time card entry. |
| Matching open entry with **Auto** or **Auto – Same Entry Only** | Clocks off the matching entry. |
| Matching open entry with **Manual** | Selects the entry without automatically clocking it off through this scan. |

Matching considers the time card, production order, production order line, operation, and setup/run context. The request above uses the example run-time barcode `/O00000001%`. To record setup time instead, use the operation’s setup barcode, represented here by `/N00000001%`. Run-time and setup-time barcodes are not interchangeable when identifying the entry to stop.

To stop time in an automatic mode, scan the same routing barcode again while its matching entry is open. Read the time card afterwards to confirm the stop. A workflow can prevent clock-off, and scanning again after a successful stop can create a new entry.

## Example 5: Stop a specific time card line

When the application already knows the time card line to stop, submit `ClockOff` with `TIME_CARD` context:

```
GET BASE_URL/Company('CRONUS Canada, Inc.')/TCMServerBarcode?$filter=
  Input_Action_Type_Code eq 'MENUITEM' and
  Input_Action_Data eq 'ClockOff' and
  Input_Config_No eq 'CFG000001' and
  Input_Employee_No eq 'EMP001' and
  Input_Time_Card_No eq 'TC000123' and
  Input_Screen_Code eq 'TIME_CARD' and
  Input_Address eq '192.168.123.45' and
  Selected_Row_Key_1 eq 'TC000123' and
  Selected_Row_Key_2 eq '10000'
```

In this context, key 1 is the **time card number** and key 2 is the **time card line number**. Omit key 3. These keys have different meanings from the production dispatch keys in Example 3.

The action runs the line clock-off calculation, subject to configured workflows and time-splitting rules. Read the time card before and after the action to verify the result.

Stopping production time is separate from ending a shift, finishing a production operation, and posting a time card.

## Handling action responses

Responses from `TCMServerBarcode` contain a `value` array. Each row includes:

- `Sort_No`: processing order.
- `Response_Code`: the instruction returned by Business Central.
- `Response_Data`: the instruction’s payload.

Process the rows in ascending `Sort_No` order. Payloads can span several rows because `Response_Data` is limited to 200 characters per row. Append each consecutive `CHUNK` row to the preceding instruction’s data, without adding separators. Parse JSON only after reconstructing the complete payload.

| Response code | How to handle it |
| --- | --- |
| `RESP.NOOP` | Diagnostic information. It does not confirm that time changed. |
| `RESP.DECODE` | Barcode decoding details. It does not confirm that a clock action completed. |
| `RESP.SIGNIN` | Parse the JSON and retain the employee, time card, and client configuration. |
| `RESP.RELOADTC` | Parse `Time_Card_Header_No` and refresh that card’s lines. |
| `RESP.SELECTLINE` | Parse `Time_Card_Header_No` and `Line_No` to identify the line to inspect. |
| `RESP.ERROR` | Handle the plain-text application error, even if the HTTP response was successful. |
| `RESP.MESSAGE` | Parse and display/log the JSON `title` and `message`. |
| `RESP.LOCK` | Clear or lock the local employee interaction context. This alone does not confirm an end-of-shift. |
| `RESP.CONFIRM`, `RESP.PROMPT`, `RESP.SETWORKFLOW`, `RESP.SERVERACTION` | Additional interaction or workflow processing is required. |

Other instructions can request output, consumption, quality inspection, or other application interaction. A custom application must handle the configured interaction or clearly report that it requires an unsupported feature. Do not silently ignore an interaction and report that the overall process completed.

An HTTP success response is not sufficient to determine whether time started or stopped. Read the affected time card lines and inspect their start/creation and clock-off timestamps. An unset clock-off timestamp indicates that an automatic entry has not been clocked off; recognize the endpoint’s representation of an unset DateTime rather than assuming it is always JSON `null`. Zero run/setup time alone does not establish clock state. `Operation_Complete` indicates routing completion, not whether the time entry is clocked off.

Do not use `$top`, `$skip`, `$count`, or automatic page traversal on `TCMServerBarcode` to obtain action responses. Another request can execute the action again. Treat an incomplete or unexpectedly paged action response as an unresolved result and reconcile the time card state.

## Example 6: Read the employee’s time card

Use the time card number returned by sign-in, or a later response identifying the current card:

```
GET BASE_URL/Company('CRONUS Canada, Inc.')/TCMTimeCardLine?$filter=
  Time_Card_No eq 'TC000123'
```

The response contains a `value` array of time card lines. A valid card can have no lines yet. Unlike the action endpoint, this is an ordinary data read, and normal OData paging can be followed.

Useful properties include:

| Property | Meaning |
| --- | --- |
| `Time_Card_No`, `Line_No` | Time card line identity. |
| `Employee_No`, `Employee_Name` | Employee recorded on the line. |
| `Document_No`, `Document_Line_No` | Production order and production order line for production entries. |
| `Task_No` | Operation number for production entries. |
| `Activity_Code` | Recorded activity. |
| `Entry_Creation_Time`, `Entry_Clock_Off_Time` | Creation/start and stop timestamps. |
| `Setup_Time`, `Run_Time`, `Time_Entry_Unit_of_Measure` | Recorded time and its unit. Do not assume every time value is in hours. |
| `Work_Date` | Work/posting date. A shift can span more than one calendar date. |

For a group time card, add `and Employee_No eq 'EMP001'` if only that employee’s lines should be returned. Preserve the returned time-zone information when displaying timestamps.

These examples read the card obtained at sign-in. They do not provide a separate read-only lookup of the current card using only an employee number. Do not sign an employee in solely to perform an inquiry, because sign-in can create or change a time card.

### Optional: Return calculated card and weekly totals

```
POST BASE_URL/TCMTimeCardHeader_CalcTimeCardTimeODATA?company=CRONUS Canada, Inc.
Authorization: Bearer {access_token}
Accept: application/json
Content-Type: application/json

{"pcodTimeCardHeaderNo":"TC000123"}
```

The outer OData response’s `value` is an encoded JSON string. Parse it to obtain numeric `pdHoursThisCard` and `pdHoursThisWeek` values. Use these calculated totals when hours are needed rather than assuming all recorded line units are hours.

## Example 7: End the employee’s shift

Submit `EndShift` with the employee’s current time card and configuration:

```
GET BASE_URL/Company('CRONUS Canada, Inc.')/TCMServerBarcode?$filter=
  Input_Action_Type_Code eq 'MENUITEM' and
  Input_Action_Data eq 'EndShift' and
  Input_Config_No eq 'CFG000001' and
  Input_Employee_No eq 'EMP001' and
  Input_Time_Card_No eq 'TC000123' and
  Input_Screen_Code eq 'TIME_CARD' and
  Input_Address eq '192.168.123.45'
```

No selected-row keys are required. This ends the shift for the time card, rather than stopping only the selected operation.

The standard action updates the logout time, performs the applicable clock-off and time card closing calculations, marks the employee off site, and closes the time card. Configured time card workflows can also run. The response includes `RESP.LOCK`; clear the local signed-in context after handling the response. Start a new employee interaction through sign-in rather than continuing to record against the closed card.

Time card posting remains a separate process. Ending a shift should not be treated as confirmation that its time has been posted.

## Example 8: Get work instructions for a selected time card line

First read the selected production time card line as in Example 6. Use its `Time_Card_No`, `Line_No`, `Document_No`, `Document_Line_No`, and `Task_No` values:

```
GET BASE_URL/Company('CRONUS Canada, Inc.')/TCMWorkInstructionsRouting?$filter=
  Status eq 'Released' and
  Prod_Order_No eq 'RPO00123' and
  Routing_Reference_No eq 10000 and
  Operation_No eq '20' and
  SFI_Time_Card_No eq 'TC000123' and
  SFI_Time_Card_Line_No eq 10000
```

| Work-instruction input | Selected time card line property |
| --- | --- |
| `Prod_Order_No` | `Document_No` |
| `Routing_Reference_No` | `Document_Line_No` |
| `Operation_No` | `Task_No` |
| `SFI_Time_Card_No` | `Time_Card_No` |
| `SFI_Time_Card_Line_No` | `Line_No` |

**For this service, `Routing_Reference_No` accepts the production order line number.** Pass `Document_Line_No`, rather than looking up the routing’s reference number.  Routing Reference No. and Prod. Order Line No. are not the same in Business Central, this discrepancy in the naming convention is a legacy restriction from earlier versions of the product.   Numeric page filters such as `Routing_Reference_No` and `SFI_Time_Card_Line_No` are unquoted, unlike the string-based selected-row keys used by `TCMServerBarcode`.

This example requires a production order time card line associated with a released order. The time card inputs provide additional time card context; the operation filter still identifies which operation’s instructions to retrieve.

The response contains a `value` array with instruction text in `Comment`. Process the rows in `Line_No` order. The standard content includes production order comments and comments for the selected production routing operation. Depending on Shop Floor Setup, the response can also include time and quantity details. Long text can be split across successive comment rows; these are not `CHUNK` responses from the action service. Customizations can add other content.

This service returns instruction/comment data. It does not download linked documents or attachments.

## Example 9: Get work instructions for a selected dispatch line

Use the selected row from `TCMDispatch`:

```
GET BASE_URL/Company('CRONUS Canada, Inc.')/TCMWorkInstructionsRouting?$filter=
  Status eq 'Released' and
  Prod_Order_No eq 'RPO00123' and
  Routing_Reference_No eq 10000 and
  Operation_No eq '20'
```

| Work-instruction input | Dispatch row property |
| --- | --- |
| `Prod_Order_No` | `Prod_Order_No` |
| `Routing_Reference_No` | `Prod_Order_Line_No` |
| `Operation_No` | `Operation_No` |

As in Example 8, use the **production order line number** for `Routing_Reference_No`. Omit the time card inputs when the inquiry is based only on a dispatch selection. The employee does not need to start time on that operation to read its instructions.

The example assumes a released production order. If your dispatch settings include other statuses, use the selected order’s actual status. Interpret the returned `Comment` rows as described in Example 8.

## Example 10: Get the BOM for a selected time card line

Read the selected production time card line and use its production order, production order line, and operation:

```
GET BASE_URL/Company('CRONUS Canada, Inc.')/TCMBom?$filter=
  Status eq 'Released' and
  Prod_Order_No eq 'RPO00123' and
  Prod_Order_Line_No eq 10000 and
  pcodOperation eq '20'
```

| BOM input | Selected time card line property |
| --- | --- |
| `Prod_Order_No` | `Document_No` |
| `Prod_Order_Line_No` | `Document_Line_No` |
| `pcodOperation` | `Task_No` |

The BOM service does not take a time card number. Resolve the production details from the selected time card line first. This example requires a production order entry, rather than a job, absence, or other document type.

The response is the production order’s component list, not the master Production BOM definition. Useful returned properties include:

| Property | Meaning |
| --- | --- |
| `Line_No` | Production **component** line number. Retain this for recording consumption. |
| `Prod_Order_No`, `Prod_Order_Line_No` | Parent production order and production order line. |
| `Item_No`, `Variant_Code`, `Description` | Component item details. |
| `Unit_of_Measure_Code` | Component unit of measure. |
| `Expected_Quantity`, `Remaining_Quantity` | Expected and remaining component quantities. Remaining quantity is adjusted for unposted consumption journal quantities. |
| `Routing_Link_Code` | Component routing link. |
| `Location_Code` | Component location. |
| `LotTracked`, `SerialTracked` | Tracking indicators for the component. |

`pcodOperation` supplies the operation context. When the operation has a Routing Link Code, the service includes components with that code **and components without a Routing Link Code**. If no applicable link code is found, it does not apply that operation-based component restriction. Omit `pcodOperation` to request the component list without that restriction.

## Example 11: Get the BOM for a selected dispatch line

Use the selected dispatch row directly:

```
GET BASE_URL/Company('CRONUS Canada, Inc.')/TCMBom?$filter=
  Status eq 'Released' and
  Prod_Order_No eq 'RPO00123' and
  Prod_Order_Line_No eq 10000 and
  pcodOperation eq '20'
```

| BOM input | Dispatch row property |
| --- | --- |
| `Prod_Order_No` | `Prod_Order_No` |
| `Prod_Order_Line_No` | `Prod_Order_Line_No` |
| `pcodOperation` | `Operation_No` |

The request is the same as Example 10; only the source of the selection differs. No time card number or clock-on action is required. Use the selected order’s actual status if it is not released. The component properties and Routing Link Code behavior are described in Example 10.

## Recording output and consumption

The next examples call codeunit actions using **POST**, rather than page reads. Their URL format is:

```
BASE_URL/{serviceName}_{procedureName}?company=CRONUS Canada, Inc.
```

Send the OAuth headers and `Content-Type: application/json`. Use the exact JSON parameter names shown below; numbers are JSON numbers, and unused text parameters are empty strings. Replace all illustrative identifiers with values from your company.

These recording actions do not return the `TCMServerBarcode` instruction array or a newly created journal line number. A successful request may have no response body. Check HTTP/Business Central errors and verify the resulting journal and item tracking entries before reporting the recording as complete. Do not automatically repeat a request after a timeout: a repeat can record the quantity again.

## Example 12: Record output for a lot-tracked item

This example records five units of finished production output against an existing production time card line, assigning lot `LOT-001`.

Before calling it:

- Confirm that the selected time card line identifies the intended released production order, production order line, and operation.
- Use the client configuration returned at sign-in, with a valid **Output Batch Name**.
- Confirm that the production item is lot tracked. For this example, use an output unit of measure with a conversion of one to the base unit.
- Supply a valid lot number, location, and bin as required by the item/location setup. The example uses a location that does not require a bin or license plate.

```
POST BASE_URL/TCMOutputMgmt_RecordOutput?company=CRONUS Canada, Inc.
Authorization: Bearer {access_token}
Accept: application/json
Content-Type: application/json

{
  "ptxtConfigNo": "CFG000001",
  "ptxtTimeCardNo": "TC000123",
  "piTimeCardLineNo": 10000,
  "pdQuantity": 5,
  "pdScrap": 0,
  "pcodScrapCode": "",
  "pcodLotNumber": "LOT-001",
  "pcodSerialNumber": "",
  "pcodLocationCode": "MAIN",
  "pcodBinCode": "",
  "pcodLicensePlate": ""
}
```

The service derives the production order, order line, item, variant, operation, and work/machine center from the selected time card line and its production order. Do not add those values as extra JSON parameters.

The request creates an output journal entry using the configuration’s output batch and adds item tracking for the supplied lot and quantity. The posting date uses the selected line’s **Work Date**, where available. The time card’s recorded output quantity is also updated. Quantity and over-output validation still apply.

For bin-required locations, provide the correct `pcodBinCode`. If license plates are required, provide the appropriate `pcodLicensePlate`; a blank value can use a license plate already associated with the time card. Passing blank does not override mandatory setup.

Recording output and posting output are separate steps. Verify the output journal and its item tracking lines. On the final operation, posting the output is the inventory receipt step; recording the request alone is not confirmation that finished goods inventory has increased.

## Example 13: Record consumption for a serial-tracked component

This example consumes one unit of component `COMP-SN` with serial number `SN-001`, against component line `20000` on the production order. It uses an existing production time card line.

Read the BOM as in Example 10 or 11 and retain the selected component’s `Line_No`, `Item_No`, `Variant_Code`, and `Location_Code`. For this example, the component unit of measure is one base unit per unit, and the serial number is available in the selected location. If the item also requires a lot number, supply that lot along with the serial number.

The client configuration associated with the time card must have a valid **Consumption Batch Name**. In this example that batch is `CONS001`.

```
POST BASE_URL/TCMConsumptionMgmt_RecordConsumption?company=CRONUS Canada, Inc.
Authorization: Bearer {access_token}
Accept: application/json
Content-Type: application/json

{
  "pcodBatchName": "CONS001",
  "pcodTimeCardHeaderNo": "TC000123",
  "piTimeCardLineNo": 10000,
  "pcodLocationCode": "MAIN",
  "pcodProdOrderNo": "RPO00123",
  "piProdOrderLineNo": 10000,
  "piProdOrderCompLineNo": 20000,
  "pcodItemNo": "COMP-SN",
  "pcodVariant": "",
  "pdQuantity": 1,
  "pcodLotNumber": "",
  "pcodSerialNumber": "SN-001",
  "psDescription": "Serial-tracked component consumption"
}
```

| Parameter | Source/meaning |
| --- | --- |
| `pcodTimeCardHeaderNo`, `piTimeCardLineNo` | Selected production time card line. |
| `pcodProdOrderNo`, `piProdOrderLineNo` | Parent production order and production order line. Keep these consistent with the selected time card line. |
| `piProdOrderCompLineNo` | BOM row’s `Line_No`: the **component** line number. |
| `pcodItemNo`, `pcodVariant`, `pcodLocationCode` | Selected component’s item, variant, and location. |
| `pcodSerialNumber` | The specific serial number being consumed. |

The three line-number parameters identify different records: `piTimeCardLineNo` is the time entry, `piProdOrderLineNo` is the produced item’s order line, and `piProdOrderCompLineNo` is the component line.

With a valid selected time card line, the service resolves its client configuration and uses that configuration’s **Consumption Batch Name**. `pcodBatchName` does not override the batch selected from that configuration. The sign-in response’s encoded `Client_Config` includes `Consumption_Batch_Name`, which can be used to populate this example’s value.

Submit one request per serial number, with a quantity representing exactly one base unit. Do not pass a comma-separated list of serial numbers. The request creates a consumption journal entry and its item tracking; the posting date uses the time card line’s Work Date where available. This method has no bin override parameter, so required bin details must be resolved through the production component and Business Central setup.

Verify the consumption journal’s production order/component references, quantity, location/bin, and serial tracking. Posting the consumption journal is a separate step; recording the request alone does not confirm that inventory has been consumed.

Validate the request patterns, response handling, configured workflows, item tracking, and time-zone display in a test environment before using the integration for live production recording.
