---
category: [Administration & Integrations, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions, Platform and Product Extensions/Workday Extend, Platform and Product Extensions/Integration]
keyword: [Extend, Model Components, Extend Business Objects, MCBO, Model Component Business Objects, Business Objects, Model BO]
nav: wcp_docs
parent_url: /wcp_docs/
title: >- 
  Example: Add Derived Fields to Business Objects
layout: subsection
---

### Scenario

<a id="context_N1002B_N10028_N10001"></a>
This topic illustrates how you can use derived fields in Workday Extend business objects. You can use derived fields in combination with:

-   Other derived fields in the same business object.
-   Standard fields in the same business object.
-   Standard or derived fields in other Extend business objects in the same app.


### Prerequisites

<a id="prereq_fbv_mzq_5fb"></a>
-   Workday Extend Plugin for IntelliJ.
-   Charitable Donations sample app.


### Steps

1.  <a id="step_N10059_N10056_N10028_N10001"></a>Review the Charity business object in the Charitable Donations app. The derived fields are in a sibling `derivedFields []` array to the standard fields.

    ```
    {
      "id": 1,
      "name": "Charity",
      "label": "Charity",
      "defaultSecurityDomains": [
        "ManageCharities"
      ],
      "defaultCollection": {
        "name": "charities",
        "label": "All Charities"
      },
      "fields": [
        {
          "id": 1,
          "name": "name",
          "type": "TEXT",
          "label": "Name",
          "useForDisplay": true,
          "isReferenceId": true
        },
        {
          "id": 2,
          "name": "description",
          "type": "TEXT",
          "label": "Description"
          
        },
        {
          "id": 3,
          "name": "matchDonations",
          "type": "BOOLEAN",
          "label": "Match Donations"
        },
        {
          "id": 4,
          "name": "relationshipManager",
          "type": "SINGLE_INSTANCE",
          "label": "Relationship Manager",
          "target": "WORKER"
        },
        {
          "id": 5,
          "name": "logo",
          "type": "SINGLE_INSTANCE",
          "label": "Logo",
          "target": "CharityLogo"
        },
        {
          "id": 6,
          "name": "createdBy",
          "type": "SINGLE_INSTANCE",
          "label": "Created By",
          "target": "WORKER",
          "secureByTarget": true
        }
      ],
      "derivedFields": [
        {
          "id": 1,
          "name": "logoUploadedBefore2022",
          "type": "BOOLEAN",
          "label": "Logo Before 2022",
          "expression": "logo.uploadedDate.toYear().toNumber() < 2022"
        },
        {
          "id": 2,
          "name": "logoLabel",
          "type": "TEXT",
          "label": "Logo Label",
          "expression": "logoUploadedBefore2022 ? 'Old Image' : 'New Image'"
        },
        {
          "id": 3,
          "name": "workdayMatched",
          "type": "BOOLEAN",
          "label": "Workday Matched Charity",
          "expression": "matchDonations && (description == 'Workday Charity')"
        }
      ]
    }
    ```

    Note that the `logoLabel` derived field references the derived field `logoUploadedBefore2022` in its expression.

2.  <a id="step_N1006A_N10056_N10028_N10001"></a>Create the Charitable Donation business object. Author the derived fields in a sibling `derivedFields []` array to the standard fields.

    ```
    {
      "id": 2,
      "name": "CharitableDonation",
      "label": "Charitable Donation",
      "defaultSecurityDomains": [
        "ManageCharitableDonations",
        "SelfServiceCharitableDonations"
      ],
      "defaultCollection": {
        "id": 1,
        "name": "charitableDonations",
        "label": "All Charitable Donations"
      },
      "fields": [
        {
          "id": 1,
          "name": "charity",
          "type": "SINGLE_INSTANCE",
          "label": "Charity",
          "target": "Charity"
        },
        {
          "id": 2,
          "name": "worker",
          "type": "SINGLE_INSTANCE",
          "label": "Worker",
          "target": "WORKER",
          "secureByTarget": true
        },
        {
          "id": 3,
          "name": "amount",
          "type": "DECIMAL",
          "label": "Amount",
          "decimals": 5
        },
        {
          "id": 4,
          "name": "startDate",
          "type": "DATE",
          "label": "Start Date",
          "precision": "DAY"
        },
        {
          "id": 5,
          "name": "endDate",
          "type": "DATE",
          "label": "End Date",
          "precision": "DAY"
        },
        {
          "id": 6,
          "name": "ongoing",
          "type": "BOOLEAN",
          "label": "Ongoing"
        }
      ],
      "derivedFields": [
        {
          "id": 1,
          "name": "isOldDonation",
          "type": "BOOLEAN",
          "label": "Old Donation",
          "expression": "endDate.toYear().toNumber() < 2022"
        },
        {
          "id": 2,
          "name": "normalizedAmount",
          "type": "DECIMAL",
          "decimals": 2,
          "label": "Normalized Amount",
          "expression": "(amount + amount * 2) / 12"
        },
        {
          "id": 3,
          "name": "donationSummary",
          "type": "TEXT",
          "label": "Donation Summary",
          "expression": "'Donated ' + amount + ' to ' + charity.name + ' on ' + startDate.toString() + '.'"
        }
      ]
    }
    ```

    Note that the `donationSummary` derived field references a field of the Charity business object in its expression. Workday supports this field reference because the Charitable Donation business object contains a `SINGLE_INSTANCE` field with `"target": "Charity"`.



### Related Information

[Concept: Derived Fields](/wcp_docs/nuk1625697865548.html)

[Tutorial: Model Components: Derived Fields](https://wd5.myworkday.com/workday/learning/course/dfa49d237c9d016f69e98f56e0023c71?type=9882927d138b100019b928e75843018d)

[Reference: Derived Fields](/wcp_docs/syr1643821053546.html)

[App Catalog: Charitable Donations](/app-catalog/charitableDonations)

