# Subworkflow – Add Long Lost Fine

Creates a standardized WRLC Long Lost replacement fine in the patron's home Alma Institution Zone and returns the new fine ID and amount to the calling workflow.

#### At a glance

- **Status:** Active
- **Environment / Tags:** Network Zone, Live, CLS Long Lost Items
- **Applies consortium-wide?:** Yes
- **Runs on:** WRLC Alma Institution Zones (the patron's home Institution Zone)
- **Trigger:** Executed by another workflow
- **Primary outcome:** Creates a WRLC Long Lost replacement fine on a patron's Alma account and returns the fine ID and amount.
- **Who receives results:** The calling workflow (no emails or reports are generated).

---

#### Why this exists

This subworkflow centralizes the logic to create WRLC Replacement Fines in different Institution Zones.

---

#### What it does

- **Required input:**
    - `home_primary_id` – Patron's primary identifier
    - `patron_home_institution_code` – Patron's home Alma institution code
    - `patron_home_institution` – Patron's home institution name
    - `owner_of_item` – Institution that owns the long lost item
    - `title` – Item title
    - `barcode` – Item barcode
    - `reformatted_loan_date` – Original loan date (MM-DD-YYYY)
    - `reformatted_due_date` – Original due date (MM-DD-YYYY)
- Connects to the patron's home Alma Institution Zone using the supplied institution code.
- Creates a **$110** active WRLC Long Lost replacement fine on the patron's account using the Alma Create Fine/Fee API.
- Includes a standardized fine comment indicating: 
    - the item is no longer eligible for return,
    - which institution paid the replacement cost,
    - which institution the patron now owes,
    - the item title, loan date, due date, and barcode.
- Retrieves the Alma-generated fine ID and amount after the fine is created.
- **Returns:**
    - `fine_id` – Alma identifier for the newly created fine
    - `fine_amount` – Amount of the fine that was created
    - All original input fields

---

#### Where it runs

- **Alma IZ(s):** Any WRLC Institution Zone identified by the incoming `patron_home_institution_code`
- **Systems touched:**
    - LibOW Alma Network node
    - Alma Users API (Create Fine/Fee)
- **Reports / queries used:** None

---

#### How it works

##### Logic overview

- The workflow is invoked by another workflow and receives the required patron and item information.
- The Alma Network node connects to the appropriate Institution Zone based on the patron's home institution.
- A request body is constructed containing: 
    - Fine type
    - Active status
    - $110 replacement amount
    - A standardized comment containing the institution names, title, loan date, due date, and barcode
- The Alma Create Fine/Fee API creates the fine on the patron's account.
- The workflow extracts the Alma-generated fine ID and amount.
- Those values are added to the original input and returned to the parent workflow.

##### If results exist

- The newly created `fine_id` and `fine_amount` are returned to the calling workflow, along with all original input fields.

##### If no results

- If the Alma API does not successfully create a fine, the API node is configured to continue returning data so that the calling workflow can inspect and handle the response rather than terminating unexpectedly.

##### Artifacts produced

None. The workflow creates a fine directly in Alma and returns data to the calling workflow.