---
title: "rules"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/5671190536/rules"
format: markdown
---
Determines various types of rules to configure mobile application. 

There are following sections available

- [backup](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5670764609)
- [https://upperdeck.atlassian.net/wiki/spaces/5032869905/pages/edit-v2/6161072158/](https://upperdeck.atlassian.net/wiki/spaces/5032869905/pages/edit-v2/6161072158/)
- [warnings](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5670535236)
- [sync](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5670830103)
- assistant
- [privileges](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5671092244)
- requiredRelationships
- [items](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5670535260)
- readonly
- actions
- defaultPaths
- [timesheets](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5670404161)
- [pricing](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5671518215)
- [installedProducts](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5671452675)
- [otherDefaults](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5671190556)
- scopeNames
- [attachments](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5670830130)
- [status](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5671124996)
- [type](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5671026696)
- [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5670797326](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5670797326)
- [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5858525186](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5858525186)
- [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/6292668452](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/6292668452)

Sample settings from reference config

<details>
<summary>Sample rules settings Config</summary>

```
"rules": {
    "backup": {
        "interval": 24,
        "autobackup": true
    },
    "logs": {
        "changesHistory": 500
    },
    "warnings": {
        "configuration": false,
        "offline": {
            "period": 240
        }
    },
    "sync": {
        "intervalBasedSyncEnabled": false,
        "quickStatusSync": true,
        "syncIdLimit": 5000,
        "interval": 10,
        "custom": [
            "ON_SAVE_CHECKLIST",
            "ON_DUPLICATE"
        ]
    },
    "assistant": {
        "visible": false
    },
    "privileges": {
        "checkPrivileges": false,
        "showPrivilegesAlerts": true,
        "hidePrivilegesUI": false,
        "onRead": "accessible",
        "onEdit": "updateable",
        "onDelete": "deletable",
        "onCreate": "createable"
    },
    "requiredRelationships": [
        "FIELDBUDDY__Service_Request__c",
        "FIELDBUDDY__Installed_Product__c",
        "FIELDBUDDY__Location__c",
        "Account"
    ],
    "items": {
        "table": "FIELDBUDDY__Work_Order_Item__c",
        "useDetailsAsChecklist": true,
        "openDetailsTab": true,
        "initialNumToRenderOnDetailsTab": 10
        "openDetailsTab": true,
        "initialNumToRenderOnDetailsTab": 10,
        "useDisplayType": true,
        "hideStatus": false,
        "chooseDefaultStatus": {
            "targetField": "FIELDBUDDY__Status__c",
            "targetValue": {
                "Open": {
                    "executor": "jsonQuery",
                    "type": "filter",
                    "source": "${DATA}",
                    "formula": "FIELDBUDDY__Work_Order__c[Id=${CURRENT_WORK_ORDER}&FIELDBUDDY__Type__c=INSPECTION]:isNotEmpty"
                },
                "Closed": {
                    "executor": "jsonQuery",
                    "type": "filter",
                    "source": "${DATA}",
                    "formula": "FIELDBUDDY__Work_Order__c[Id=${CURRENT_WORK_ORDER}&FIELDBUDDY__Type__c!=INSPECTION]:isNotEmpty"
                }
            }
        },
        "statistics": {
            "fieldName": "C",
            "fieldsToRequest": [
                "count(Id) C",
                "FIELDBUDDY__Type__c"
            ],
            "objectName": "FIELDBUDDY__Work_Order_Item__c",
            "groupBy": [
                "FIELDBUDDY__Type__c"
            ],
            "skipRecordsFromBriefcase": false
        },
        "icons": {
            "Activity": "wrench",
            "Part": "cube",
            "Other Expense": "credit-card",
            "Delete": "trash",
            "Add": "plus",
            "search-plus": "search-plus"
        },
        "limits": {
            "maxItemsToDisplay": 25,
            "maxResultToDisplay": 20
        }
    },
    "readonly": [
        {
            "condition": {
                "rule": "==",
                "value": "CLOSED"
            },
            "field": "FIELDBUDDY__Status__c",
            "table": "FIELDBUDDY__Work_Order__c"
        },
        {
            "condition": {
                "rule": "isIncomplete"
            }
        }
    ],
    "actions": {
        "active": true
    },
    "renderEngine": "2.0",
    "defaultPaths": {
        "Service_Request": {
            "FIELDBUDDY__Timesheet__c": "FIELDBUDDY__Timesheet__c",
            "Account": "FIELDBUDDY__Service_Request__c.FIELDBUDDY__Account__c",
            "Contact": "FIELDBUDDY__Service_Request__c.FIELDBUDDY__Contact__c",
            "FIELDBUDDY__Installed_Product__c": "FIELDBUDDY__Service_Request__c.FIELDBUDDY__Installed_Product__c",
            "FIELDBUDDY__Location__c": "FIELDBUDDY__Service_Request__c.FIELDBUDDY__Installed_Product__c.FIELDBUDDY__Location__c",
            "FIELDBUDDY__Product__c": "FIELDBUDDY__Service_Request__c.FIELDBUDDY__Installed_Product__c.FIELDBUDDY__Product__c",
            "FIELDBUDDY__Sub_location__c": "FIELDBUDDY__Service_Request__c.FIELDBUDDY__Installed_Product__c.FIELDBUDDY__Sub_location__c",
            "FIELDBUDDY__Service_Agreement__c": "FIELDBUDDY__Service_Request__c.FIELDBUDDY__Installed_Product__c.FIELDBUDDY__Service_Agreement__c",
            "FIELDBUDDY__Service_Request__c": "FIELDBUDDY__Service_Request__c",
            "FIELDBUDDY__Timesheet_Lineitem__c": "FIELDBUDDY__Timesheet_Lineitems__r[]",
            "FIELDBUDDY__Work_Order_Line_Item__c": "FIELDBUDDY__Work_Order_Line_Items__r[]"
        },
        "Location": {
            "FIELDBUDDY__Timesheet__c": "FIELDBUDDY__Timesheet__c",
            "Account": "FIELDBUDDY__Location__c.FIELDBUDDY__Account__c",
            "Contact": "FIELDBUDDY__Contact__c",
            "FIELDBUDDY__Installed_Product__c": "FIELDBUDDY__Work_Order_Line_Items__r[].FIELDBUDDY__Installed_Product__c",
            "FIELDBUDDY__Product__c": "FIELDBUDDY__Product__c",
            "FIELDBUDDY__Location__c": "FIELDBUDDY__Location__c",
            "FIELDBUDDY__Sub_location__c": "FIELDBUDDY__Work_Order_Line_Items__r[].FIELDBUDDY__Installed_Product__c.FIELDBUDDY__Sub_location__c",
            "FIELDBUDDY__Service_Agreement__c": "FIELDBUDDY__Service_Agreement__c",
            "FIELDBUDDY__Service_Request__c": "FIELDBUDDY__Service_Request__c",
            "FIELDBUDDY__Timesheet_Lineitem__c": "FIELDBUDDY__Timesheet_Lineitems__r[]",
            "FIELDBUDDY__Work_Order_Line_Item__c": "FIELDBUDDY__Work_Order_Line_Items__r[]"
        }
    },
    "timesheets": {
        "stopwatch": true,
        "stopwatchRules": {
            "start": [
                {
                    "status": "ON_THE_GO",
                    "type": "Reizen"
                },
                {
                    "status": "IN_PROGRESS",
                    "type": "Servicebezoek"
                }
            ],
            "stop": [
                "OPEN",
                "ARRIVED",
                "CLOSED"
            ]
        },
        "implicit": false,
        "manual": false,
        "table": "FIELDBUDDY__Timesheet__c",
        "filterOut": [
            "Lunch",
            "Vakantie",
            "Training",
            "Travel home",
            "Vergadering",
            "Training"
        ],
        "groupBy": {
            "table": "FIELDBUDDY__Timesheet_Lineitem__c",
            "field": "FIELDBUDDY__Type__c",
            "icons": {
                "Servicebezoek": "wrench",
                "Reizen": "car",
                "Travel home": "car",
                "Vergadering": "users",
                "Lunch": "hourglass",
                "Service visit": "wrench",
                "Travel": "car",
                "Internal meeting": "users",
                "Consignatie Nacht": "moon-o",
                "Consignatie Dag": "sun-o",
                "Consignatie Avond": "adjust",
                "Vakantie": "map-signs",
                "Training": "graduation-cap",
                "Opleiding": "graduation-cap",
                "Concept": "file"
            }
        }
    },
    "pricing": {
        "showAggregations": {
            "subtotal": true,
            "subtotalLabel": "${Label.Subtotal}",
            "vat": true,
            "vatLabel": "${Label.VAT}",
            "total": true,
            "totalLabel": "${Label.Total}"
        },
        "showPrices": {
            "activities": false,
            "parts": true,
            "otherExpenses": true
        },
        "includeVAT": true,
        "precision": 2
    },
    "installedProducts": {
        "enableSorting": [
            "Name",
            "FIELDBUDDY__Installed_Product_Number__c"
        ]
    },
    "otherDefaults": {
        "pagination": {
            "installedProducts": 5
        },
        "barcodeEnabled": false
    },
    "scopeNames": {
        "relatedWorkOrdersForInstalledProduct": {
            "initAt": "FIELDBUDDY__Work_Order__c",
            "scope": [
                {
                    "up": "FIELDBUDDY__Installed_Product__c",
                    "down": "FIELDBUDDY__Work_Order__c",
                    "relatedsObjectName": "FIELDBUDDY__Work_Order_Line_Item__c",
                    "relatedObjectIsJunction": true
                },
                {
                    "down": "FIELDBUDDY__Service_Request__r.Installed_Product__c",
                    "up": "Id",
                    "relatedsObjectName": "FIELDBUDDY__Installed_Product__c",
                    "relatedObjectIsJunction": false
                }
            ]
        },
        "relatedWorkOrdersForLocation": {
            "initAt": "FIELDBUDDY__Work_Order__c",
            "scope": [
                {
                    "up": "Id",
                    "down": "FIELDBUDDY__Location__c",
                    "relatedsObjectName": "FIELDBUDDY__Location__c",
                    "relatedObjectIsJunction": false
                },
                {
                    "up": "Id",
                    "down": "FIELDBUDDY__Service_Request__r.FIELDBUDDY__Installed_Product__r.FIELDBUDDY__Location__c",
                    "relatedsObjectName": "FIELDBUDDY__Location__c",
                    "relatedObjectIsJunction": false
                }
            ]
        },
        "relatedWorkOrdersForServiceRequest": {
            "initAt": "FIELDBUDDY__Work_Order__c",
            "scope": [
                {
                    "up": "Id",
                    "down": "FIELDBUDDY__Service_Request__c",
                    "relatedsObjectName": "FIELDBUDDY__Service_Request__c",
                    "relatedObjectIsJunction": false
                }
            ]
        }
    },
    "attachments": {
        "pdfMode": "preview",
        "cropOption": true,
        "compression": 0.5,
        "heicCompression": 0.5,
        "maxPictures": 45
    },
    "status": {
        "hidden": [
            "CLOSED",
            "CANCELLED"
        ]
    },
    "type": {
        "colors": {
            "INSTALLATION" : "#6d9137",
            "INSPECTION" : "#00ff77",
            "INCIDENT" : "red",
            "REMOVAL" : "darkred",
            "OVERHAUL" : "lightsteelblue",
            "MAINTENANCE" : "turquoise",
            "PREVENTIVE MAINTENANCE" : "turquoise",
            "CORRECTIVE MAINTENANCE" : "orange",
            "DEFAULT": "#00AAFF"
        } 
    }
}
```
</details>

#### assistant

Define an appearance of the Swift Assistant (icon in the right-top corner.

| property | Description | Sample Value | Default |
| --- | --- | --- | --- |
| **visible** | determines if the Swift Assistant is displayed or not<br>Note: the back-end defined Actions (Relaunch, Hard Reset) will **not** be disabled if the Assistant is hidden! | ```
"visible": false
``` | true |

|  |  |
| --- | --- |
| `createable` | ```
"onCreate": "createable"
``` |

#### readOnly

Define an array of filtering restrictions which may cause Work Order to be shown as read only. Sample filter definition

| property | Description | Sample Value | Notes |
| --- | --- | --- | --- |
| **table** | sObject API name on which rule is applied | ```
"table": "FIELDBUDDY__Work_Order__c"
``` |  |
| **field** | field API name on which rule is applied | ```
"field": "FIELDBUDDY__Status__c"
``` |  |
| **condition** | object, determines condition | ```
 ["ARRIVED", "CLOSED", "IN_PROGRESS", "ON_THE_GO", "OPEN"]
``` |  |
| **rule** | child of **condition**, defines operator | ```
"rule": "=="
``` |  |
| **value** | child of **condition**, defines value on right side of operator | ```
"value": "CLOSED"
``` |  |

#### actions

Will support globally defined actions that are represented as ActionButtons in the Swift UI

<details>
<summary>sample actions config</summary>

```
"actions": {
    "active": true
}
```
</details>

| property | Description | Sample Value | Default |
| --- | --- | --- | --- |
| **active** | Support for a globally defined actions.   
Should not be changed | true | false |