---
title: "Clear Single-Instance Fields & Bind graph:createId in Graph"
description: "Fix Expected IdentifierInput errors on createdBy with graph:createId() in GraphQL mutations, and clear single-instance MBO relationships via REST PUT or PATCH."
url: https://kiweely.com/guides/workday-graphql-clear-single-instance-null-graph-createid
---

# Clearing Single-Instance Relationships to Null and Binding createdBy with graph:createId() in Graph API

Workday Graph API mutations require nested IdentifierInput objects for single-instance relationships like createdBy—which you can generate cleanly in PMD with graph:createId(id). To clear an existing single-instance relationship back to null, use the Model Business Object REST PUT or PATCH API.

-   **Checked** against Workday on November 6
-   Applies to **Workday Extend**
-   2 min read
-   Published November 6
-   By Kiweely

## Problem 1: `Reason: 'createdBy.id' Expected 'IdentifierInput', found not an object`

When you create or update a Model Business Object (`MBO`) using a Workday Graph API mutation on an Extend Presentation Metadata (`PMD`) page, single-instance relationship fields—such as a `createdBy` field targeting `WORKER`—do not accept a flat `{"id": "<WID>"}` or `{"workdayID": {"id": "<WID>"}}` object.

If you bind your mutation input variables in the PMD `outboundEndPoints` block like this:

json

```
{
  "leaseClassificationTestingUnderAsc842_XXX_createLeases_input": {
    "leaseName": "<% leaseName.value %>",
    "startDate": "<% startDate.value.format('yyyy-MM-dd') ?? '' %>",
    "createdBy": {
      "id": "<% createdBy.value %>"
    }
  }
}
```

submitting the page fails immediately with a GraphQL input validation error:

text

```
Variable '$leaseClassificationTestingUnderAsc842_XXX_createLeases_input' expected value of type 'LeaseClassificationTestingUnderAsc842_XXX_LeasesSummary_CreateInput!'
Reason: 'createdBy.id' Expected 'IdentifierInput', found not an object. (line 1, column 23)
```

In the Workday Graph API schema, every relationship input expects an outer object whose `id` property is itself an `IdentifierInput` object containing both `"id"` and `"type"` (`"WID"` or a reference ID type):

json

```
"createdBy": {
  "id": {
    "id": "3aa5550b7fe348b98d7b5741afc65534",
    "type": "WID"
  }
}
```

### Fix: Use the PMD `graph:createId(id)` helper function

Instead of hand-coding nested `"id": {"id": ..., "type": "WID"}` structures across every relationship field in your `.pmd` file, use the built-in PMD `graph:createId(id)` function. Passing a 32-character Workday ID string to `graph:createId(...)` automatically expands to the exact `{"id": {"id": "<value>", "type": "WID"}}` structure required by GraphQL mutations:

json

```
{
  "name": "createLeases",
  "baseUrlType": "workday-graphql",
  "httpMethod": "POST",
  "authType": "sso",
  "graphQuery": {
    "queryId": "createLeases",
    "variables": {
      "leaseClassificationTestingUnderAsc842_XXX_createLeases_input": {
        "fairValueofAsset": {
          "currency": "<% fairValueofAssetCurrencyCode.value[0] ?? null %>",
          "value": "<% fairValueofAssetValue.value %>"
        },
        "discountRate": "<% discountRate.value %>",
        "determingValueMethod": "<% determingValueMethod.value[0] %>",
        "leaseName": "<% leaseName.value %>",
        "startDate": "<% startDate.value.format('yyyy-MM-dd') ?? '' %>",
        "endDate": "<% endDate.value.format('yyyy-MM-dd') ?? '' %>",
        "createdBy": "<% graph:createId(createdBy.value) %>"
      }
    }
  }
}
```

Note that if `createdBy` is bound to an `instanceList` widget rather than a plain text variable, pass the selected element `graph:createId(createdBy.value[0])` (or `graph:createId(currentLoginUser.id)` when stamping the current user).

## Problem 2: Clearing a single-instance relationship to `null` on an Edit page

On an edit page where a user can clear an optional `instanceList` bound to a single-instance relationship on an `MBO` (for example, unassigning a secondary reviewer or clearing an optional `Worker` reference), attempting to clear the relationship through a Graph API update mutation fails:

javascript

```
const selectedValue = workerInstanceList.value[0] ?? '';
const jsonObject = { 'id': { 'id': selectedValue, 'type': 'WID' } };
const payload = empty(workerInstanceList.value) ? {:} : jsonObject;
return payload;
```

-   If you pass `null` for the single-instance field in the GraphQL update mutation variables, the Graph API ignores the `null` property and leaves the existing relationship value unchanged on the business object instance.
-   If you pass an empty map `{:}` or `{"id": {"id": "", "type": "WID"}}`, the Graph API throws a schema or `S21` validation error because an empty `IdentifierInput` is not a valid target instance.

### Fix: Use the Extend Business Object REST API (`PUT` or `PATCH`) to clear single-instance fields

When an edit page must support clearing a single-instance relationship back to empty (`null`), use the generated Model Business Object REST endpoint (`baseUrlType: "app"`) instead of a GraphQL mutation:

1.  **Using `PUT /<collectionName>/{id}`:** A `PUT` request replaces the record state with the supplied payload. When you omit the cleared single-instance relationship property from the `PUT` JSON body (or set it to `null`), Workday unlinks the previous single-instance reference.
2.  **Using `PATCH /<collectionName>/{id}`:** Explicitly pass `null` for the single-instance relationship field when `workerInstanceList.value` is empty:

json

```
{
  "name": "updateLeaseRecord",
  "baseUrlType": "app",
  "url": "<% 'leases/' + routeParams.leaseId %>",
  "httpMethod": "PATCH",
  "authType": "sso",
  "onSend": "<%
    var body = {
      'leaseName': leaseName.value,
      'assignedWorker': empty(workerInstanceList.value)
        ? null
        : { 'id': workerInstanceList.value[0] }
    };
    return body;
  %>"
}
```

## How to verify the fix in your tenant

1.  Open your Create page, populate the form, and submit. Inspect the created record in a `WQL` query (`SELECT workdayID, leaseName, createdBy FROM <app>_leases`) or in **Graph API Explorer** to verify that `createdBy` is populated with the target `Worker` WID.
2.  Open your Edit page for that record, clear the optional `instanceList` selection so `workerInstanceList.value` is empty, and click **OK**.
3.  Re-query the record in **View WQL Query Result** and confirm that the single-instance relationship field is now empty rather than retaining its previous `WID`.

## Sources checked

-   [Example: graph Namespace Functions](https://developer.workday.com/documentation/GUID-1dc1fd91-da7b-419f-9efd-6ba1243a1e36-enHYPHENus)
-   [Graph API Mutations](https://developer.workday.com/documentation/kbu1671067116723)
-   [Submit Graph API Mutations on a Page](https://developer.workday.com/documentation/pnn1671585287177)
-   [Sample Graph Query Components in PMDs](https://developer.workday.com/documentation/yvb1682352201818)
-   [Model Components in the Graph API Schema](https://developer.workday.com/documentation/xng1652977416314)

## Related guides

[All guides](https://kiweely.com/guides)

-   [### Handling Silent GraphQL Errors in PMD and Orchestrate When HTTP Status Returns 200 OK Workday Graph API endpoints return HTTP 200 OK even when a query or mutation fails with an S21 or validation error inside the JSON errors array. Inspect $.errors explicitly in Orchestrate and verify that your .amd base URL version matches Graph API Explorer.](https://kiweely.com/guides/workday-graphql-http-200-silent-mutation-errors)
-   [### Fixing Graph API DataSourceFilter Is Inaccessible Errors and Blank processingWorker Fields When Proxying Workday Graph API queries fail with DataSourceFilter is inaccessible when the caller lacks View access to the domain securing the filter, and silently return blank fields on processingWorker when Employee As Self lacks contact domain permissions.](https://kiweely.com/guides/workday-graphql-datasourcefilter-inaccessible-processingworker-proxy)
-   [### Why Attachment Model Components and contentType Are Missing from the GraphQL Schema After Migrating to IMPL After promoting a Workday Extend app with an Attachment Business Object to an Implementation or Sandbox tenant, GraphQL queries can fail with Unknown type \_DataSources or missing contentType fields. Refresh the model cache, verify ISU domain security, and check tenant Graph schema availability.](https://kiweely.com/guides/workday-graphql-attachment-schema-contenttype-missing-impl)
-   [### Why PATCH from an SSO PMD Page Fails with unrecognized field While the Same Payload Succeeds in Postman When a PATCH request to an Extend Model Business Object fails with 400 unrecognized field from an SSO PMD page even though the same fields succeed in Postman, widget valueOutBinding declarations are merging extra keys into self.data. Log json:asJSON(self.data) and return a clean payload in onSend.](https://kiweely.com/guides/workday-extend-pmd-patch-unrecognised-field-sso-vs-postman)

### More guides on Extend apps and pages

[All 97 guides](https://kiweely.com/guides#extend)

-   [Splitting New and Existing PMD Grid Rows in onSend for Bulk POST and PATCH Without Duplicating Records](https://kiweely.com/guides/workday-extend-pmd-split-new-modified-grid-rows-bulk-post-patch)
-   [Fixing radioGroup Options Disappearing When selectedValues Is Empty and Disabling Specific Options in Workday Extend PMD](https://kiweely.com/guides/workday-extend-pmd-radiogroup-options-disappear-disable-specific-items)
-   [Why a RaaS Endpoint Returns HTTP 200 with data as null in PMD and How to Surface SOAP Fault Messages](https://kiweely.com/guides/workday-extend-pmd-raas-report-entry-null-soap-fault-http-200)
-   [Deleting Selected Grid Rows and Fixing Parallel Multi-Instance Arrays Collapsing on Edit Pages in Workday Extend PMD](https://kiweely.com/guides/workday-extend-pmd-grid-delete-selected-rows-parallel-arrays-collapse)
-   [Displaying dynamicColumns in a Workday Extend PMD Grid and Flattening Nested Arrays into Rows](https://kiweely.com/guides/workday-extend-pmd-dynamic-grid-columns-flattening-arrays)
-   [Conditional Page Routing on Load, multiStepLayout vs. tabBar Navigation, and flowVariables Payload Limits in Workday Extend PMD](https://kiweely.com/guides/workday-extend-pmd-conditional-page-routing-tabbar-flowvariables-limits)
-   [Clearing Grid Cell Validation Errors on onChange and Blocking Page Save on pageActionButton Failure in Workday Extend PMD](https://kiweely.com/guides/workday-extend-pmd-clear-grid-cell-error-pageactionbutton-block-save)
-   [Resolving “Tenant mapping not found (OP-4008)”, EU vs. US Regional Base URL 401 Errors, and client\_secret\_basic in Workday Extend OAuth 2.0](https://kiweely.com/guides/workday-extend-oauth-tenant-mapping-op-4008-eu-base-url-client-secret-basic)

### From the blog on Extend apps and pages

[All posts](https://kiweely.com/blog)

-   [What functional consultants can and cannot do with Workday Extend AI](https://kiweely.com/blog/workday-extend-for-functional-consultants-ai)
-   [Put a Workday Extend App in Git from Day One](https://kiweely.com/blog/workday-extend-git-from-day-one)
-   [Pairing Claude Code with a Personal Workday Extend Tenant for Portfolio Apps](https://kiweely.com/blog/claude-code-personal-workday-extend-tenant-portfolio)

## Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

[Start for free](https://kiweely.com/download) [See how it works](https://kiweely.com/vine/how-it-works)

## Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.
