---
title: "Example 6: Check if technician added attachment(s) to work order before closing the work order"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/5987926021/Example+6%3A+Check+if+technician+added+attachment(s)+to+work+order+before+closing+the+work+order"
format: markdown
---
![Simulator Screen Recording - iPhone 13 mini - 2025-01-10 at 10.02.14.mp4](media://4583b8e5-58b5-4ea3-bebd-a6686db9b774)


### Configuration

- Add the following event object to `apps[number].screens[number].config.footerLayout.config.events[number]`
  - If there are multiple validations needed, they can be seperately added under `validation`.

```json
{
  "validation": [
    {
      "executor": "jsonQuery",
      "type": "validation",
      "alertType": "warning",
      "source": "${MEDIA_LIBRARY}",
      "alertDefaultText": "Bijlagen benodigd om deze Werkbon te sluiten.",
      "alertMessage": "${Label.NoAttachments}",
      "formula": "[*Linked=${CURRENT_WORK_ORDER}]:isNotEmpty"
    }
  ],
  "condition": [
    {
      "field": "Status",
      "filter": "==",
      "value": "CLOSED"
    }
  ],
  "dataBinding": [
    {
      "field": "Name",
      "table": "FIELDBUDDY__Work_Order__c",
      "var": "NAME"
    },
    {
      "field": "Id",
      "table": "FIELDBUDDY__Work_Order__c",
      "var": "ID"
    }
  ],
  "eventName": "onValueChanged",
  "target": "WorkOrderClosurePlus",
  "triggeredEvent": "navigate"
}
```

Here is the interface of a Media object:

```typescript
interface Media {
  Id: string;
  RemoteId: string;
  IsAttachment: boolean;
  IsDocument: boolean;
  FileName: string;
  Linked: [string];
  LinkedObjects: Record<string, string[]>;
  URL: string;
  AssetLink: string;
  isOpen: boolean;
  FileType: string;
  FileExtension: string;
  IsFailed: boolean;
  IsBeingUploaded: boolean;
  IsUploaded?: boolean;
  IsLocal?: boolean;
  FileSize: number;
}
```

The validation event uses `Linked`field to achieve the objective, but any other field can be utilized for other validation rules.

A working example can be found in line 953 of [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5986680865](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5986680865)