# Subworkflow - Create Items in SCF IZ

#### At a glance

· **Status:** Active  
· **Environment / Tags:** SCF Workflow  
· **Applies consortium-wide?:** No, specific to Shared Collections Facility Institution Zone  
· **Runs on:** SCF Production Alma IZ  
· **Trigger:** Runs only when called by another workflow  
· **Primary outcome:** Creates or locates an SCF IZ bib/holding, then creates an item in that holding.  
· **Who receives results:** Returns a success or error result to the calling workflow.

#### Why this exists

This subworkflow supports shared print / SCF item creation by moving item data from a calling workflow into the SCF Alma institution zone. It helps ensure that an item can be represented in SCF with the correct bib, holding, location, provenance, and barcode pattern.

#### What it does

- Receives item, bib, institution, location, and linking data (Network Id) from another workflow.
- Preserves the incoming barcode for later error reporting
- Searches SCF Alma for a matching bib record. 
    - If a matching bib exists, retrieves the first bib and checks its holdings.
    - If no matching bib exists and the record is NZ-linked, creates an SCF IZ bib from the NZ record.
    - If no matching bib exists and the record is not NZ-linked, creates a new SCF IZ bib using the provided bib record, adding a local 035 field for the owning institution and MMS ID.
- Checks whether a holding already exists in SCF for the target SCF location. 
    - If no matching holding exists, creates a suppressed SCF holding.
- Builds a new item request body by clearing local-only fields, appending `X` to the barcode, setting provenance to the owning institution code, and setting library/location to SCF values.
- Creates the item in Alma and returns either `successfully imported` or an error message.

#### Where it runs

· **Alma IZ(s):** SCF Production Alma IZ  
· **Systems touched:** Alma APIs  
· **Credentials referenced:** SCF Production - Alma APIs - Read &amp; Write  
· **Reports / queries used:** None

#### How it works

##### Logic overview

1. <span data-end="2081" data-start="2046">Search for the bib in the SCF IZ</span>
2. **If a matching SCF bib is found:** the workflow retrieves that bib, checks for an SCF holding at the requested location, creates a holding if needed, then creates the item.
3. **If no matching SCF bib is found but the source is NZ-linked:** the workflow creates an SCF IZ bib from the NZ MMS ID, then creates the holding and item.
4. **If no matching SCF bib is found and the source is not NZ-linked:** the workflow creates a new SCF IZ bib from the supplied bib record, adds a local 035 field, then creates the holding and item.
5. **If an Alma create step fails:** the workflow returns an error result with the barcode, error type, and error message.
6. **If item creation succeeds:** the workflow returns the barcode and `successfully imported`.

**Artifacts produced:** No files or reports. The output is structured JSON returned to the calling workflow.