> ## Documentation Index
> Fetch the complete documentation index at: https://klef.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Oracle Fusion

<div className="page-title-row">
  <img src="https://mintcdn.com/klef/xJ0kXbcegZOD2G3h/images/connectors/oracle-fusion.png?fit=max&auto=format&n=xJ0kXbcegZOD2G3h&q=85&s=b2722294b9d4537d205c471eab68d517" alt="" noZoom width="32" height="32" data-path="images/connectors/oracle-fusion.png" />

  <h1>Oracle Fusion</h1>
</div>

## Connection

### Setup

<Steps>
  <Step title="Create an integration user">
    Create a Fusion user for Klef that will not be offboarded.
  </Step>

  <Step title="Assign the job roles">
    Give it the job roles under [Permissions](#permissions). They are what open the
    [HCM REST APIs](https://docs.oracle.com/en/cloud/saas/human-resources/farws/index.html) to it.
  </Step>
</Steps>

### Settings

| Setting  | Required | Description                              |
| -------- | -------- | ---------------------------------------- |
| Base URL | Yes      | Address of your Oracle Fusion pod.       |
| Username | Yes      | User Klef signs in as.                   |
| Password | Yes      | Password of that user. Stored encrypted. |

### Permissions

Minimum permissions the connection requires.

| Capability                        | Required | Granted by (any one)                                                           |
| --------------------------------- | -------- | ------------------------------------------------------------------------------ |
| Read and write the worker roster  | Yes      | `Human Capital Management Integration Specialist`, `Human Resource Specialist` |
| Read the location list            | Yes      | `Human Capital Management Integration Specialist`, `Human Resource Specialist` |
| Read and deactivate user accounts | Yes      | `IT Security Manager`                                                          |
| Assign roles to user accounts     |          | `IT Security Manager`                                                          |

## oracle\_fusion.worker

### Fields

| Field                                                                | Type              | Required | Description                                                                                                                                                                         |
| -------------------------------------------------------------------- | ----------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `personNumber`                                                       | string, up to 30  | Yes      | Person number. Identifies the worker in Oracle.                                                                                                                                     |
| `firstName`                                                          | string, up to 150 | Yes      | First name.                                                                                                                                                                         |
| `lastName`                                                           | string, up to 150 | Yes      | Last name.                                                                                                                                                                          |
| `legislationCode`                                                    | string, up to 2   | Yes      | Two-letter code of the country whose legislation applies, such as US.                                                                                                               |
| `emails`                                                             | array             |          | Email addresses on the person record. Rows are matched on `emailType`. At most one row sets `primaryFlag`.                                                                          |
| `emails[].emailType`                                                 | string, up to 30  | Yes      | Email type code. Your pod may define more. Values: `W1` (Work email), `H1` (Home email), `W2` (Work email 2), `H2` (Home email 2).                                                  |
| `emails[].emailAddress`                                              | string, up to 240 | Yes      | Email address.                                                                                                                                                                      |
| `emails[].primaryFlag`                                               | bool              |          | Whether this is the primary address.                                                                                                                                                |
| `active`                                                             | bool              |          | Whether the worker's user account can sign in.                                                                                                                                      |
| `workRelationships`                                                  | array             |          | Employment with each legal employer. Rows are matched on `legalEmployerName`. A row the policy drops is ended by setting `terminationDate`.                                         |
| `workRelationships[].legalEmployerName`                              | string, up to 240 | Yes      | Legal employer, by name.                                                                                                                                                            |
| `workRelationships[].workerType`                                     | enum              | Yes      | Kind of worker. Values: `E` (Employee), `C` (Contingent worker), `N` (Nonworker), `P` (Pending worker).                                                                             |
| `workRelationships[].hireDate`                                       | date              | Yes      | Start of the work relationship.                                                                                                                                                     |
| `workRelationships[].terminationDate`                                | date              |          | End of the work relationship.                                                                                                                                                       |
| `workRelationships[].notificationDate`                               | date              |          | Date the termination was notified.                                                                                                                                                  |
| `workRelationships[].effectiveFrom`                                  | date              |          | Date a change to the work relationship takes effect.                                                                                                                                |
| `workRelationships[].assignments`                                    | array             |          | Assignments under the work relationship. Rows are matched on `assignmentNumber`. At most one row sets `primaryFlag`. A row the policy drops is ended by the `endAssignment` action. |
| `workRelationships[].assignments[].assignmentNumber`                 | string, up to 30  | Yes      | Assignment number. Identifies the assignment.                                                                                                                                       |
| `workRelationships[].assignments[].assignmentName`                   | string, up to 80  |          | Assignment name.                                                                                                                                                                    |
| `workRelationships[].assignments[].actionCode`                       | string, up to 30  |          | Action recorded with the change, such as HIRE.                                                                                                                                      |
| `workRelationships[].assignments[].reasonCode`                       | string, up to 30  |          | Reason recorded with the action.                                                                                                                                                    |
| `workRelationships[].assignments[].businessUnitName`                 | string, up to 240 | Yes      | Business unit, by name.                                                                                                                                                             |
| `workRelationships[].assignments[].jobCode`                          | string, up to 30  |          | Job code.                                                                                                                                                                           |
| `workRelationships[].assignments[].locationCode`                     | string, up to 30  |          | Location code.                                                                                                                                                                      |
| `workRelationships[].assignments[].defaultExpenseAccount`            | string            |          | Default expense account, as its account segments.                                                                                                                                   |
| `workRelationships[].assignments[].primaryFlag` (Primary assignment) | bool              |          | Whether this is the worker's primary assignment.                                                                                                                                    |
| `workRelationships[].assignments[].effectiveFrom`                    | date              |          | Date a change to the assignment takes effect.                                                                                                                                       |
| `workRelationships[].assignments[].manager`                          | link              |          | Line manager, set from the worker's manager.                                                                                                                                        |
| `roles`                                                              | grant             |          | Roles provisioned to the worker's user account. One row grants one role.                                                                                                            |
| `roles[]`                                                            | string            |          | Role name.                                                                                                                                                                          |

### Default Account Matching Rules

When Klef [adopts](/docs/adoption) an account that already exists in Oracle Fusion, it works out whose it is by trying these in order. A connection can override them.

| Account field  | Worker field         |
| -------------- | -------------------- |
| `personNumber` | `worker.employee_id` |

## Examples

### Oracle HCM worker provisioning

An Entra mailbox and a nested Oracle Fusion employment record across five stages, with a worker's assignments expanded one for one.

```hcl theme={null}
stage active {
  # Oracle nests employment under a work relationship, and the assignments under that. The
  # assignment number, the location ids and the reporting line are Oracle's to mint, so the
  # policy writes the shape and lets the connector settle the rest.
  target oracle_fusion.worker {
    personNumber    = worker.employee_id
    firstName       = worker.legal_name.given
    lastName        = worker.legal_name.family
    legislationCode = "US"
    active          = true

    # The mailbox address is the one field genuinely mastered in Entra, so it is read back out
    # of the account this same policy provisions.
    emails = [
      { emailType = "W1", emailAddress = microsoft_entra.mail, primaryFlag = true },
    ]

    workRelationships = [
      {
        legalEmployerName = "Acme Logistics LLC"
        workerType        = "E"
        hireDate          = worker.hire_date

        assignments = each worker.assignments as assignment
          where assignment.status == "Active" {
          assignmentNumber      = assignment.source_id
          assignmentName        = assignment.job.name
          actionCode            = "HIRE"
          businessUnitName      = lookup(table.oracle_business_unit, assignment.business_unit.name)
          jobCode               = assignment.job.code
          locationCode          = assignment.location.code
          defaultExpenseAccount = script.default_expense_account
          primaryFlag           = assignment.is_primary
          effectiveFrom         = assignment.start_date
        }
      },
    ]

    roles = ["Employee"]
  }
}
```
