Use Scope Fault Handler in OIC

Share

  • Introduction

    Use Scope Fault Handler in OIC is a critical technique used by integration developers to control and manage errors inside specific logical sections of an integration flow. In modern enterprise integrations built using Oracle Integration Cloud (OIC Gen 3), error handling must be precise, structured, and maintainable.

    In real enterprise projects integrating systems like Oracle Fusion Cloud Applications, Oracle ERP Cloud, or external applications such as Salesforce or Workday, integrations often involve multiple API calls, transformations, and conditional logic. When an error occurs in one part of the integration, we may want to handle it locally without failing the entire integration.

    This is where Scope Fault Handlers become extremely powerful.

    Instead of relying only on global error handling, OIC allows developers to define fault handling logic at the scope level, meaning the integration can recover, log errors, or trigger alternative actions without terminating the entire process.

    In this detailed guide, we will explore how to Use Scope Fault Handler in OIC, how it works in real projects, and how consultants design reliable integrations using this feature.


    What is a Scope Fault Handler in OIC?

    A Scope Fault Handler is an error handling mechanism in Oracle Integration Cloud (Gen 3) that allows developers to catch and handle exceptions occurring within a specific scope block of an integration.

    A Scope is essentially a container that groups multiple integration actions together.

    Typical actions inside a scope include:

    • Invoke REST APIs

    • Invoke SOAP services

    • Data mappings

    • Switch conditions

    • Stage File operations

    • Database adapter calls

    • For-each loops

    When any action inside the scope throws an error, the Scope Fault Handler intercepts it and executes a defined recovery flow.

    Key Concept

    Instead of letting the error propagate to the Global Fault Handler, the integration handles the error locally.

    This approach improves:

    • Integration resilience

    • Error visibility

    • Business process continuity


    Key Features of Scope Fault Handler

    Scope-level fault handling provides several powerful capabilities.

    1. Localized Error Handling

    Errors are handled only within the scope, preventing unnecessary integration failures.

    Example:

    • A customer lookup API fails

    • Instead of stopping the integration, fallback logic executes


    2. Multiple Error Handling Strategies

    The fault handler can perform different actions such as:

    • Logging error messages

    • Sending notification emails

    • Calling alternative APIs

    • Setting default values

    • Retrying operations


    3. Supports Business Continuity

    Critical in integrations like:

    • Employee onboarding

    • Purchase order processing

    • Invoice synchronization

    Even if one system fails, the integration can continue processing.


    4. Structured Integration Design

    Using scopes creates modular integrations.

    Example:

    ScopePurpose
    Customer ValidationValidate customer data
    Order ProcessingProcess order
    Invoice CreationCreate invoice

    Each scope has its own error handling logic.


    Real-World Integration Use Cases

    Scenario 1 — Customer Creation Integration

    Integration flow:

    CRM → OIC → ERP Customer Creation API

    Steps:

    1. Validate customer data

    2. Check duplicate customer

    3. Create customer in ERP

    If the duplicate check API fails, the scope fault handler:

    • Logs error

    • Skips duplicate validation

    • Continues with customer creation


    Scenario 2 — Employee Onboarding Integration

    Integration flow:

    HR System → OIC → Fusion HCM

    Steps:

    • Create employee

    • Assign department

    • Assign manager

    If manager assignment fails, the scope handler:

    • Logs warning

    • Assigns default manager

    • Continues onboarding


    Scenario 3 — Invoice Integration

    Integration flow:

    Procurement System → OIC → ERP Invoice API

    Steps:

    • Fetch invoice data

    • Validate supplier

    • Create invoice

    If supplier validation API fails:

    • Scope fault handler retries

    • Sends email notification

    • Marks invoice as pending


    Architecture and Technical Flow

    The technical architecture of Scope Fault Handling looks like this:

     
    Integration Flow
    |
    |– Scope 1
    | |– Actions
    | |– Fault Handler
    |
    |– Scope 2
    | |– Actions
    | |– Fault Handler
    |
    |– Global Fault Handler
     

    Execution Flow

    1. Integration starts

    2. Actions execute inside scope

    3. If error occurs:

      • Scope Fault Handler triggers

    4. If not handled:

      • Global Fault Handler executes


    Prerequisites

    Before implementing a Scope Fault Handler in OIC, ensure the following:

    Environment Requirements

    • Access to Oracle Integration Cloud Gen 3

    • Integration developer role

    • Configured connections

    Example connections:

    • REST Adapter

    • SOAP Adapter

    • FTP Adapter

    • ERP Cloud Adapter


    Integration Components

    You should already understand:

    • OIC integration flows

    • Invoke actions

    • Scope components

    • Global fault handler

    • Data mapping


    Step-by-Step: Use Scope Fault Handler in OIC

    Now let’s walk through a practical example.

    Scenario:

    Customer creation integration where API failure must be handled locally.


    Step 1 — Create an Integration

    Navigate to:

    Home → Integrations → Create

    Select:

    App Driven Orchestration

    Provide values:

    FieldValue
    Integration NameCustomerCreationIntegration
    IdentifierCUSTOMER_CREATION_INT

    Save the integration.


    Step 2 — Add Trigger

    Add a REST trigger.

    Example:

     
    POST /createCustomer
     

    Payload:

     
    {
    “CustomerName”: “ABC Corp”,
    “Email”: “contact@abc.com”
    }
     

    Step 3 — Add Scope Component

    Drag Scope into the integration flow.

    Rename it:

     
    CustomerCreationScope
     

    Inside the scope, add all business logic.


    Step 4 — Add Invoke Action

    Invoke ERP Customer Creation API.

    Adapter:

    ERP Cloud Adapter

    Operation:

    Create Customer

    Map fields:

    SourceTarget
    CustomerNamePartyName
    EmailEmailAddress

    Step 5 — Configure Scope Fault Handler

    Click the Scope component.

    Select:

     
    Add Fault Handler
     

    OIC automatically creates a fault handling branch.


    Step 6 — Add Error Handling Logic

    Inside the fault handler, add actions.

    Example:

    1. Assign Action

    Store error message.

     
    $error/description
     

    Map to variable:

     
    ErrorMessage
     

    2. Logger Action

    Log error details.

    Example message:

     
    Customer creation failed: $ErrorMessage
     

    3. Send Email Notification

    Use notification service.

    Subject:

     
    Customer creation failure
     

    Body:

     
    Customer API failed with error: $ErrorMessage
     

    Step 7 — Continue Integration Flow

    After the fault handler executes, the integration can:

    • Continue processing

    • Skip failed logic

    • Send response

    Example response:

     
    {
    “status”: “Customer creation attempted”,
    “errorHandled”: true
    }
     

    Testing the Scope Fault Handler

    Testing is extremely important.

    Test Scenario

    Send payload:

     
    {
    “CustomerName”: “Test Corp”,
    “Email”: “test@test.com”
    }
     

    Force API failure by:

    • Stopping ERP service

    • Using invalid credentials

    • Sending invalid payload


    Expected Behavior

    Instead of integration failure:

    • Fault handler executes

    • Error is logged

    • Notification sent

    • Integration returns response


    Monitor the Integration

    Navigate to:

     
    Home → Monitoring → Integrations → Tracking
     

    Check:

    • Execution instance

    • Fault details

    • Fault handler actions


    Common Errors and Troubleshooting

    1. Fault Handler Not Triggered

    Cause:

    Error occurs outside the scope.

    Solution:

    Ensure actions are inside the scope container.


    2. Incorrect Error Variable Mapping

    Incorrect reference:

     
    $error.message
     

    Correct reference:

     
    $flow/fault
     

    Always inspect the fault payload.


    3. Integration Still Failing

    Cause:

    Fault handler rethrows error.

    Solution:

    Remove throw fault action.


    4. Logging Not Visible

    Cause:

    Logger not configured.

    Solution:

    Enable activity stream logging in integration settings.


    Best Practices for Using Scope Fault Handler

    Experienced consultants follow several practices.

    1. Always Group Logic Using Scopes

    Large integrations should be modular.

    Example:

    ScopePurpose
    EmployeeCreationCreate employee
    PayrollSetupConfigure payroll
    BenefitsAssignmentAssign benefits

    Each scope handles its own errors.


    2. Avoid Excessive Nested Scopes

    Too many scopes make integrations difficult to debug.


    3. Log Detailed Error Messages

    Always capture:

    • Fault code

    • Fault message

    • Integration ID

    • Timestamp


    4. Combine with Global Fault Handler

    Use layered error handling:

    LevelPurpose
    Scope Fault HandlerLocal recovery
    Global Fault HandlerFinal failure handling

    5. Use Fault Handling for Retry Logic

    Example retry strategy:

    1. API call fails

    2. Scope handler retries call

    3. If still failing → send alert


    Frequently Asked Questions (FAQ)

    1. What is the difference between Scope Fault Handler and Global Fault Handler?

    Scope Fault Handler

    • Handles errors within a specific scope.

    Global Fault Handler

    • Handles errors across the entire integration.

    Scope fault handlers allow more granular error management.


    2. Can multiple scopes have their own fault handlers?

    Yes.

    Each scope can contain its own fault handler, allowing different error handling strategies across the integration.


    3. Does Scope Fault Handler stop integration execution?

    No.

    It depends on how it is designed.

    After handling the error, the integration can:

    • Continue execution

    • Skip failed steps

    • Terminate gracefully


    Summary

    Understanding how to Use Scope Fault Handler in OIC is essential for building robust enterprise integrations.

    Modern integration platforms like Oracle Integration Cloud Gen 3 provide powerful error handling mechanisms that allow developers to build resilient, scalable, and maintainable integration architectures.

    Key takeaways:

    • Scope Fault Handlers handle errors locally

    • They improve integration reliability

    • They prevent unnecessary integration failures

    • They support modular integration design

    • They allow business processes to continue even when partial failures occur

    In real Oracle Cloud projects involving Fusion ERP, HCM, and SCM integrations, scope-based error handling is a standard practice followed by experienced integration consultants.

    For deeper technical documentation and latest platform capabilities, refer to Oracle official documentation:

    https://docs.oracle.com/en/cloud/saas/index.html


Share

Leave a Reply

Your email address will not be published. Required fields are marked *