---
title: "Work Order Closure Plus"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/3117941144/Work%20Order%20Closure%20Plus"
format: markdown
---
## Sample Structure

`WorkOrderClosurePlus` screen contains information that is shown when Work Order is being closed (Status is updated to Closed)

After it is confirmed, Swift shows [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5369692161](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5369692161) screen

Below is sample structure for the screen. Basically it contains following elements:

- `header` - header of a screen. It has one property - title, and can use custom labels
- `events` - describes which screens Swift shows based on the actions (cancel or confirm)
- `actionButtons` - contains information about actions buttons (like confirm or cancel), conditions when they are shown and what happens on clik
- `propertiesLayout` - describes layout of fields shown in [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/4350672933](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/4350672933) format

<details>
<summary>Config structure (Reference Config from 2023)</summary>

```
{
    "config": {
        "header": {
            "title": "${Label.WorkOrderClosure}"
        },
        "events": [
            {
                "dataBinding": [ 
                /// data bindings
                ],
                "eventName": "onApprove",
                "target": "WorkOrderClosed",
                "triggeredEvent": "navigate",
                "validation": [
                    {
                        "field": "ClosureStatus",
                        "rule": "required"
                    }
                ]
            }, // MORE EVENTS
        ],
        "actionButtons": [
            {
                "condition": [
                ],
                "event": {
                    "validation": [],
                    "dataBinding": [
                        {
                            "field": "Name",
                            "table": "FIELDBUDDY__Work_Order__c",
                            "var": "NAME"
                        },
                        {
                            "field": "Id",
                            "table": "FIELDBUDDY__Work_Order__c",
                            "var": "ID"
                        }
                    ],
                    "eventName": "onApply",
                    "target": "WorkOrderSummary",
                    "triggeredEvent": "navigate"
                },
                "config": {
                    "confirm": true
                }
            }
        ],
        "propertiesLayout": {
            "config": {
                "sections": [
                    {
                        "mapping": "FIELDBUDDY__Work_Order__c",
                        "title": "${FIELDBUDDY__Work_Order__c.Name.label}",
                        "objects": [
                            {
                                "name": "Name"
                            }
                        ],
                        "table": "FIELDBUDDY__Work_Order__c"
                    },// More fields
                ]
            },
            "type": "FProperties"
        }
    },
    "name": "WorkOrderClosurePlus"
},
```
</details>

Closure Screen

1. Action Buttons
2. Fields
3. Conditions

## header

Simple structure with only 1 property to set

```
"header": {
    "title": "${Label.WorkOrderClosure}"
},
```

## events

Describe screens where Swift can be navigated to. Those are used in the action buttons. Configured in a format of an array

Sample config

```
{
    "dataBinding": [
        {
            "field": "Name",
            "table": "FIELDBUDDY__Work_Order__c",
            "var": "NAME"
        },
        {
            "field": "Id",
            "table": "FIELDBUDDY__Work_Order__c",
            "var": "ID"
        }
    ],
    "eventName": "onCancel",
    "target": "WorkOrderDetails",
    "triggeredEvent": "navigate"
},
```

Properties

`dataBinding` - data bindings of the current work order. Should not be changed

`eventName` - name of event. Same as used in actionButtons

`target` - name of the screen to be opened, for example, [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5259100161](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5259100161)  (`WorkOrderDetails`) or [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5369692161](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5369692161) (`WorkOrderSummary`)

`triggeredEvent` - should be navigate

`validation` - array of validations to make event active. Example:

```
"validation": [
    {
        "field": "ClosureStatus",
        "rule": "required"
    }
]
```

## actionButtons

action buttons describe the behaviour of confirm and cancel button.  
It is possible to define few of those, and based on values of certain fields on work order – perform different action - like skip [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5369692161](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5369692161) screen (with summary and signature or keep it disabled)

actionButtons is an array, where each element has following properties  
`condition` - condition in format of JSON query (more info - [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/3113911148](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/3113911148) ) that describes when button is shown  
Example - shown when closure status is empty

```
"condition": [
    {
        "executor": "jsonQuery",
        "type": "filter",
        "source": "${DATA}",
        "formula": "FIELDBUDDY__Work_Order__c[Id=${CURRENT_WORK_ORDER}].FIELDBUDDY__Closure_Status__c:isEmpty"
    }
],
```

`event` - describes action that will occur on click. Event can have an validation on itself that will prevent action if criteria is not valid

Example - will proceed only if closure status is not empty

```
"event": {
    "validation": [
        {
            "executor": "jsonQuery",
            "type": "validation",
            "alertType": "error",
            "source": "${DATA}",
            "alertMessage": "${Label.ClosureStatusIsEmpty}",
            "alertDefaultText": "Closure Status is empty",
            "formula": "FIELDBUDDY__Work_Order__c[Id=${CURRENT_WORK_ORDER}].FIELDBUDDY__Closure_Status__c:isNotEmpty"
        }
    ],
    "eventName": "onApply",
    "target": "WorkOrderSummary",
    "triggeredEvent": "navigate"
},
```

`config`  
describes extra properties - if button is `disabled` or `confirm`  


```
"config": {
    "disabled": true
}
```

## propertiesLayout

Properties layout uses component [FProperties](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/4350672933), so it is possible show different fields there, put them under conditions or add validatios. More about it here - [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5250023575](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5250023575)  . 

Example configuration

```
"propertiesLayout": {
    "config": {
        "sections": [
            {
                "mapping": "FIELDBUDDY__Work_Order__c",
                "title": "${FIELDBUDDY__Work_Order__c.Name.label}",
                "objects": [
                    {
                        "name": "Name"
                    }
                ],
                "table": "FIELDBUDDY__Work_Order__c"
            }
        ]
    },
    "type": "FProperties"
}
```