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

# Fund Data Mapping

> Detailed field mapping for funds and GL codes between WeGive and DonorPerfect systems.

# Fund Data Mapping

This document details how WeGive funds are mapped to DonorPerfect GL codes, enabling proper fund designation and financial reporting across both systems.

## DonorPerfect Table Reference

**Primary Table**: `dpcode` (Code Tables)\
**WeGive Model**: `Fund`\
**Sync Direction**: WeGive → DonorPerfect (Push Only)

## Fund Integration Overview

### GL Code Management

<AccordionGroup>
  <Accordion title="Fund to GL Code Mapping">
    **Mapping Strategy**:

    * Each WeGive fund can have an associated DonorPerfect GL code
    * GL codes are automatically created in DonorPerfect for new funds
    * Existing GL codes are updated when fund information changes
    * Fund descriptions sync to GL code descriptions
  </Accordion>

  <Accordion title="Code Table Structure">
    **DonorPerfect Code Types**:

    * Field Name: 'GL\_CODE' (General Ledger codes)
    * Code Value: WeGive fund ID or custom code
    * Description: WeGive fund name/description
    * User ID: 'WeGive' for tracking integration records
  </Accordion>
</AccordionGroup>

## Core Fund Fields

### Primary Identifiers

<AccordionGroup>
  <Accordion title="Fund Identification">
    | WeGive Field | DonorPerfect Field | Type   | Notes                          |
    | ------------ | ------------------ | ------ | ------------------------------ |
    | `id`         | `@code`            | String | WeGive fund ID used as GL code |
    | `name`       | `@description`     | String | Fund name/description          |
    | N/A          | `@field_name`      | String | Always set to 'GL\_CODE'       |
    | N/A          | `@user_id`         | String | Always set to 'WeGive'         |
  </Accordion>

  <Accordion title="Custom GL Codes">
    **Alternative Mapping**:

    * Some funds may have custom DonorPerfect GL codes
    * Custom codes stored in `dp_gl_code` field on WeGive fund
    * Integration uses custom code if available, otherwise uses fund ID
    * Enables alignment with existing DonorPerfect chart of accounts
  </Accordion>
</AccordionGroup>

### Fund Information

<AccordionGroup>
  <Accordion title="Descriptive Fields">
    | WeGive Field  | DonorPerfect Field | Type   | Max Length | Notes                           |
    | ------------- | ------------------ | ------ | ---------- | ------------------------------- |
    | `name`        | `@description`     | String | 50         | Fund display name               |
    | `description` | Not mapped         | String | -          | Extended description not synced |
    | `category`    | Not mapped         | String | -          | Fund categories not synced      |
  </Accordion>

  <Accordion title="Field Length Handling">
    **Truncation Rules**:

    * Fund names longer than 50 characters are automatically truncated
    * Truncation preserves word boundaries where possible
    * Ellipsis (...) added to indicate truncated names
    * Full names maintained in WeGive system
  </Accordion>
</AccordionGroup>

## GL Code Creation Process

### Automatic GL Code Generation

<Steps>
  <Step title="Fund Created in WeGive">
    New fund established in WeGive system
  </Step>

  <Step title="GL Code Check">
    Integration checks if GL code exists in DonorPerfect
  </Step>

  <Step title="Code Creation">
    Creates new GL code if it doesn't exist
  </Step>

  <Step title="Description Sync">
    Updates GL code description with fund name
  </Step>

  <Step title="Validation">
    Confirms GL code is available for transaction use
  </Step>
</Steps>

### GL Code Update Process

<AccordionGroup>
  <Accordion title="Fund Name Changes">
    **Update Workflow**:

    * WeGive fund name change triggers GL code update
    * DonorPerfect GL code description updated automatically
    * Historical transactions retain original descriptions
    * New transactions use updated fund names
  </Accordion>

  <Accordion title="Fund Status Changes">
    **Active/Inactive Status**:

    * WeGive fund deactivation doesn't delete GL codes
    * GL codes remain available for historical reporting
    * New transactions prevented for inactive funds
    * Reactivation restores full functionality
  </Accordion>
</AccordionGroup>

## Data Flow Patterns

### Fund Synchronization

<AccordionGroup>
  <Accordion title="New Fund Processing">
    **Creation Sequence**:

    1. WeGive fund created by administrator
    2. Integration detects new fund
    3. GL code created in DonorPerfect dpcode table
    4. Success confirmation stored in WeGive
    5. Fund available for transaction designation
  </Accordion>

  <Accordion title="Existing Fund Updates">
    **Modification Handling**:

    * Fund name changes sync to GL code descriptions
    * Fund category changes don't sync (not supported)
    * Fund deactivation preserves GL code but prevents new use
    * Fund reactivation restores full GL code functionality
  </Accordion>
</AccordionGroup>

### Transaction Integration

<AccordionGroup>
  <Accordion title="Fund Designation in Transactions">
    **Usage Pattern**:

    * Donations specify WeGive fund for designation
    * Integration maps fund to appropriate GL code
    * Transaction syncs to DonorPerfect with GL code
    * Fund reporting available in both systems
  </Accordion>

  <Accordion title="GL Code Validation">
    **Pre-Transaction Checks**:

    * Verify GL code exists before transaction sync
    * Create GL code if missing (automatic)
    * Validate fund is active and available
    * Ensure proper permissions for GL code use
  </Accordion>
</AccordionGroup>

## API Operations

### DonorPerfect GL Code Management

<AccordionGroup>
  <Accordion title="dp_savecode Action">
    **Required Parameters**:

    ```
    @field_name = 'GL_CODE'
    @code (fund ID or custom GL code)
    @description (fund name)
    @user_id = 'WeGive'
    ```
  </Accordion>

  <Accordion title="GL Code Query">
    **SQL Query Example**:

    ```sql theme={null}
    SELECT field_name, code, description
    FROM dpcode 
    WHERE field_name = 'GL_CODE'
      AND user_id = 'WeGive'
    ORDER BY code
    ```
  </Accordion>
</AccordionGroup>

### Error Handling

<Warning>
  **GL Code Errors**: Invalid or duplicate GL codes can prevent transaction processing.
</Warning>

| Error Type             | Cause                               | Resolution                          |
| ---------------------- | ----------------------------------- | ----------------------------------- |
| **Duplicate Code**     | GL code already exists              | Use existing code or create variant |
| **Invalid Characters** | GL code contains invalid characters | Clean code format and retry         |
| **Code Too Long**      | GL code exceeds DonorPerfect limits | Truncate or use alternative code    |
| **Permission Error**   | Insufficient rights to create codes | Verify API permissions              |
| **API Timeout**        | DonorPerfect API unavailable        | Retry with backoff delay            |

## Fund Configuration

### WeGive Fund Setup

<AccordionGroup>
  <Accordion title="Basic Fund Configuration">
    **Required Fields**:

    * Fund name (required, becomes GL code description)
    * Fund status (active/inactive)
    * Organization assignment

    **Optional Fields**:

    * Custom DonorPerfect GL code (`dp_gl_code`)
    * Fund description (extended, doesn't sync)
    * Fund category (internal use only)
  </Accordion>

  <Accordion title="Custom GL Code Assignment">
    **When to Use Custom Codes**:

    * Aligning with existing DonorPerfect chart of accounts
    * Meeting specific accounting requirements
    * Maintaining consistent numbering schemes
    * Supporting multi-organization structures

    **Configuration Process**:

    1. Determine appropriate GL code in DonorPerfect
    2. Set `dp_gl_code` field in WeGive fund
    3. Integration uses custom code instead of fund ID
    4. Verify code availability and permissions
  </Accordion>
</AccordionGroup>

### DonorPerfect GL Code Requirements

<AccordionGroup>
  <Accordion title="Code Format Standards">
    **DonorPerfect Limitations**:

    * Maximum length: varies by DonorPerfect configuration
    * Allowed characters: typically alphanumeric and dashes
    * Case sensitivity: depends on DonorPerfect settings
    * Special characters: limited support
  </Accordion>

  <Accordion title="Code Organization">
    **Best Practices**:

    * Use consistent numbering schemes
    * Group related funds with similar prefixes
    * Maintain alignment with accounting standards
    * Document GL code purposes and usage
  </Accordion>
</AccordionGroup>

## Sync Configuration

### Fund Sync Settings

<AccordionGroup>
  <Accordion title="Automatic Sync Triggers">
    **Sync Events**:

    * New fund created in WeGive
    * Fund name changed
    * Fund status modified (active/inactive)
    * Custom GL code assigned or changed
  </Accordion>

  <Accordion title="Sync Timing">
    **Processing Schedule**:

    * **Real-time**: New funds and critical changes sync immediately
    * **Batch**: Name updates and status changes sync every 15 minutes
    * **Manual**: Force sync available through dashboard
    * **Validation**: Pre-transaction GL code verification
  </Accordion>
</AccordionGroup>

### Performance Considerations

<CardGroup cols={2}>
  <Card title="Efficient Processing" icon="gauge-high">
    * Batch GL code creation for multiple funds
    * Cached GL code validation for transactions
    * Minimal API calls for existing codes
    * Optimized query performance
  </Card>

  <Card title="Error Recovery" icon="refresh">
    * Automatic retry for failed GL code creation
    * Alternative code generation for conflicts
    * Manual override options for complex cases
    * Comprehensive error logging and alerts
  </Card>
</CardGroup>

## Data Quality and Validation

### Pre-Sync Validation

<AccordionGroup>
  <Accordion title="Fund Validation Rules">
    **Quality Checks**:

    * Fund name is not empty
    * Fund name length within limits
    * GL code format is valid
    * No duplicate GL codes
    * Proper organization assignment
  </Accordion>

  <Accordion title="GL Code Standards">
    **Format Validation**:

    * Alphanumeric characters only
    * Appropriate length for DonorPerfect
    * No conflicting existing codes
    * Consistent with organizational standards
  </Accordion>
</AccordionGroup>

### Monitoring and Reporting

<AccordionGroup>
  <Accordion title="Fund Sync Status">
    **Dashboard Metrics**:

    * Total funds synced to DonorPerfect
    * GL code creation success rate
    * Recent sync errors and resolutions
    * Fund-to-transaction mapping accuracy
  </Accordion>

  <Accordion title="Financial Reporting">
    **Reporting Consistency**:

    * Fund designation accuracy across systems
    * GL code usage in transaction reports
    * Fund performance comparisons
    * Donation attribution verification
  </Accordion>
</AccordionGroup>

## Best Practices

### Fund Management

<Steps>
  <Step title="Plan GL Code Structure">
    Design consistent numbering scheme before creating funds
  </Step>

  <Step title="Use Descriptive Names">
    Create clear, concise fund names within character limits
  </Step>

  <Step title="Maintain Active Status">
    Regularly review and update fund statuses as needed
  </Step>

  <Step title="Monitor Sync Status">
    Check integration dashboard for GL code sync issues
  </Step>
</Steps>

### Integration Optimization

<CardGroup cols={2}>
  <Card title="Proactive Management" icon="chart-line">
    * Create funds before launching campaigns
    * Test GL code creation in development
    * Plan for fund lifecycle management
    * Document fund purposes and usage
  </Card>

  <Card title="Error Prevention" icon="shield-check">
    * Validate fund names before creation
    * Check for duplicate GL codes
    * Maintain consistent naming conventions
    * Review DonorPerfect GL code standards
  </Card>
</CardGroup>

## Troubleshooting

### Common Fund Sync Issues

<AccordionGroup>
  <Accordion title="GL Codes Not Creating">
    **Possible Causes**:

    * Fund sync disabled in configuration
    * API permission issues
    * Invalid fund name or format
    * DonorPerfect connection problems

    **Solutions**:

    * Verify fund sync settings enabled
    * Check API credentials and permissions
    * Validate fund name format
    * Test DonorPerfect API connectivity
  </Accordion>

  <Accordion title="Duplicate GL Code Errors">
    **Possible Causes**:

    * GL code already exists in DonorPerfect
    * Multiple funds using same custom code
    * Case sensitivity conflicts

    **Solutions**:

    * Check existing GL codes in DonorPerfect
    * Use unique codes for each fund
    * Verify case sensitivity settings
  </Accordion>

  <Accordion title="Transaction GL Code Errors">
    **Possible Causes**:

    * GL code missing from DonorPerfect
    * Fund inactive or deleted
    * GL code format issues

    **Solutions**:

    * Verify GL code exists and is active
    * Check fund status in WeGive
    * Validate GL code format requirements
  </Accordion>
</AccordionGroup>

## Limitations and Considerations

### Known Limitations

<Warning>
  **Important Fund Limitations**:
</Warning>

<AccordionGroup>
  <Accordion title="Field Mapping Limitations">
    **Unsupported Fields**:

    * Extended fund descriptions don't sync
    * Fund categories not mapped to DonorPerfect
    * Fund hierarchies not supported
    * Custom fund attributes don't sync
  </Accordion>

  <Accordion title="GL Code Constraints">
    **DonorPerfect Limitations**:

    * Character limits vary by configuration
    * Special character restrictions
    * Case sensitivity depends on settings
    * Deletion restrictions for codes in use
  </Accordion>
</AccordionGroup>

### Future Considerations

<AccordionGroup>
  <Accordion title="Enhanced Fund Mapping">
    **Potential Improvements**:

    * Support for fund hierarchies
    * Extended description mapping
    * Fund category synchronization
    * Custom attribute mapping
  </Accordion>

  <Accordion title="Advanced GL Code Features">
    **Possible Enhancements**:

    * Automatic code numbering schemes
    * Fund consolidation capabilities
    * Advanced reporting integration
    * Multi-dimensional fund tracking
  </Accordion>
</AccordionGroup>

## Related Documentation

<CardGroup cols={2}>
  <Card title="Transaction Mapping" href="/donorperfect/data-mapping/transaction">
    How GL codes are used in transaction processing
  </Card>

  <Card title="Configuration Guide" href="/donorperfect/configuration-options">
    Configure fund sync settings
  </Card>

  <Card title="Integration Nuances" href="/donorperfect/integration-nuances">
    Platform-specific fund handling behaviors
  </Card>

  <Card title="Data Overview" href="/donorperfect/data-mapping/overview">
    Complete data mapping documentation
  </Card>
</CardGroup>

For additional help with fund data mapping, contact our support team at [support@wegive.com](mailto:support@wegive.com).
