---
title: "workOrderCreation"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/5671616514/workOrderCreation"
format: markdown
---
Allows to enable Service-Request based Work Order Creation in FieldBuddy Swift app

That feature works only online. User is allowed to find an account, pick a child location and installed product. After that, a Service Request and Work Order will be created.

So far, search is allowed on account, and location/installed products can only be selected from a list of related records to parent account / selected location respectively

<details>
<summary>Reference configuration workOrderCreation</summary>

```
"workOrderCreation": {
    "isEnabled": true,
    "header": {
        "title": "${Label.CreateWorkOrder}"
    },
    "event": {
        "privileges": true,
        "eventType": "createable",
        "targets": [
            "FIELDBUDDY__Work_Order__c"
        ]
    },
    "params": [
        {
            "field": "Id",
            "returnProperty": "$selectedAccount"
        },
        {
            "field": "Id",
            "returnProperty": "$selectedInstalledProduct"
        },
        {
            "field": "Id",
            "returnProperty": "$selectedLocation"
        }
    ],
    "steps": [
        {
            "allowNewRecord": false,
            "fieldsToDisplay": [
                "BillingStreet",
                "BillingPostalCode",
                "BillingCity"
            ],
            "fieldsToFilter": [
                "Name",
                "BillingStreet",
                "BillingPostalCode",
                "BillingCity"
            ],
            "fieldsToRequest": [
                "Id",
                "Name",
                "BillingStreet",
                "BillingPostalCode",
                "BillingCity"
            ],
            "label": "${Label.SelectAccount}",
            "limitOfRecords": 10,
            "returnProperty": "$selectedAccount",
            "selectedDisplay": "${Label.SelectedAccount}",
            "table": "Account",
            "tableNameDisplay": "${Label.SearchAccount}"
        },
        {
            "allowNewRecord": false,
            "fieldsToDisplay": [
                "FIELDBUDDY__Street__c",
                "FIELDBUDDY__House_Number__c",
                "FIELDBUDDY__House_Number_Suffix__c",
                "FIELDBUDDY__Postal_Code__c",
                "FIELDBUDDY__City__c"
            ],
            "fieldsToFilter": [
                "FIELDBUDDY__Account__c"
            ],
            "fieldsToRequest": [
                "Id",
                "Name",
                "FIELDBUDDY__Street__c",
                "FIELDBUDDY__House_Number__c",
                "FIELDBUDDY__House_Number_Suffix__c",
                "FIELDBUDDY__Postal_Code__c",
                "FIELDBUDDY__City__c"
            ],
            "label": "${Label.SelectLocation}",
            "limitOfRecords": 10,
            "returnProperty": "$selectedLocation",
            "selectedDisplay": "${Label.SelectedLocation}",
            "table": "FIELDBUDDY__Location__c",
            "tableNameDisplay": "${Label.SearchLocation}",
            "valueToSearch": {
                "field": "Id",
                "returnProperty": "$selectedAccount"
            }
        },
        {
            "allowNewRecord": true,
            "supportRecordTypes": false,
            "creationFields": [
                {
                    "recordType": "Default",
                    "fields": [
                        "Name",
                        "FIELDBUDDY__Construction_Year__c",
                        "FIELDBUDDY__Status__c",
                        "FIELDBUDDY__Date_Installed__c"
                    ]
                }
            ],
            "fieldsToDisplay": [
                "Name",
                "FIELDBUDDY__Installed_Product_Number__c",
                "FIELDBUDDY__Construction_Year__c"
            ],
            "fieldsToFilter": [
                "FIELDBUDDY__Location__c"
            ],
            "fieldsToRequest": [
                "Id",
                "Name",
                "FIELDBUDDY__Construction_Year__c",
                "FIELDBUDDY__Installed_Product_Number__c"
            ],
            "label": "${Label.SelectInstallation}",
            "limitOfRecords": 10,
            "returnProperty": "$selectedInstalledProduct",
            "selectedDisplay": "${Label.SelectedInstallation}",
            "table": "FIELDBUDDY__Installed_Product__c",
            "tableNameDisplay": "${Label.SearchInstallation}",
            "newTableNameDisplay": "${Label.AddInstalledProduct}",
            "valueToSearch": {
                "field": "Id",
                "returnProperty": "$selectedLocation"
            }
        }
    ]
}
```
</details>

| property | Description | Sample Value | Default |
| --- | --- | --- | --- |
| **isEnabled** | Allows to enable/disable Create WO | ```
"isEnabled": false
"isEnabled": false
``` | `true` |
| **header** | Allow to specify title for Work Order Creation, custom label can be used | ```
    "header": {
        "title": "${Label.CreateWorkOrder}"
    },
``` |  |
| **event** | Allows to enable permission check (if user is allowed to create a Work Order)<br>Not advised to change | ```
"event": {
    "privileges": true,
    "eventType": "createable",
    "targets": [
        "FIELDBUDDY__Work_Order__c"
    ]
}
``` |  |
| **params** | Describes params to be passed to the newly created work order.<br>Not advised to change | ```
"params": [
        {
            "field": "Id",
            "returnProperty": "$selectedAccount"
        },
        {
            "field": "Id",
            "returnProperty": "$selectedInstalledProduct"
        },
        {
            "field": "Id",
            "returnProperty": "$selectedLocation"
        }
    ]
``` |  |
| **steps** | Describe each step for WO creation | Array of objects, check definition below |  |


step definition

| property | Description | Sample Value | Default |
| --- | --- | --- | --- |
| **allowNewRecord** | Boolean, check if creating of new record is allowed<br>If checked – do then supportRecordTypes and creationField should be specified too | ```
"allowNewRecord": false
``` | `false` |
| **fieldsToDisplay** | Array. Which fields are shown in selection of a record | ```
"fieldsToDisplay": [
    "Name",
    "FIELDBUDDY__Installed_Product_Number__c",
    "FIELDBUDDY__Construction_Year__c"
],
``` | empty array |
| **fieldsToFilter** | Array. Which fields are used for filtering<br>For Installed Product / Location – reference to parent entity | ```
"fieldsToFilter": [
    "FIELDBUDDY__Location__c"
],
``` | empty array |
| **fieldsToRequest** | Array<br>Should contain all fields mentioned in **fieldsToDisplay** and Id | ```
"fieldsToRequest": [
    "Id",
    "Name",
    "FIELDBUDDY__Construction_Year__c",
    "FIELDBUDDY__Installed_Product_Number__c"
]
``` |  |
| **label** | Allow to specify title of a step | ```
"label": "${Label.SelectInstallation}",
``` |  |
| **limitOfRecords** | Number, amount of records returned | ```
"limitOfRecords": 10,
``` |  |
| **returnProperty** | Reference to selected entity, used by Swift in SR/WO Creation<br>Not advised to change | ```
"returnProperty": "$selectedInstalledProduct",
``` |  |
| **selectedDisplay** | Custom label for which entity is selected | ```
"selectedDisplay": "${Label.SelectedInstallation}",
``` |  |
| **table** | API name of a Object being searched | ```
"table": "FIELDBUDDY__Installed_Product__c",
``` |  |
| **tableNameDisplay** | Custom label for which entity is searched | ```
"tableNameDisplay": "${Label.SearchInstallation}",
``` |  |
| **valueToSearch** | Object, describes reference to parent object<br>Not advised to change | ```
"valueToSearch": {
    "field": "Id",
    "returnProperty": "$selectedLocation"
}
``` |  |
| **supportRecordTypes** | Boolean | ```
supportRecordTypes: true
``` |  |
| **creationFields** | Describes which fields should be populated on creation of record per record type | ```
{
    "recordType": "Default",
    "fields": [
        "Name",
        "FIELDBUDDY__Construction_Year__c",
        "FIELDBUDDY__Status__c",
        "FIELDBUDDY__Date_Installed__c"
    ]
}
``` | ```
  {
      "recordType": "Default",
      "fields": [
          "Name",
          "FIELDBUDDY__Construction_Year__c",
          "FIELDBUDDY__Status__c",
          "FIELDBUDDY__Date_Installed__c"
      ]
  }
``` |