---
title: "How to make a field required in FieldBuddy Swift?"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/5155061777/How%20to%20make%20a%20field%20required%20in%20FieldBuddy%20Swift%3F"
format: markdown
---
> Macro (toc)

# Intro

In this guide, I’ll explain how you can make a field required for input in order to preserve data quality. The use case as described below will somewhat continue on where we left off in [this](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5155389441/How+to+control+the+visibility+of+a+field+in+FieldBuddy+Swift) guide.  

Use case: On the Work Order Closure screen

When a technician sets the closure status of a Work Order = Follow_Up then the technicians needs to see a new field where he can specify what kind of work remains to be done on the follow-up work order. The second requirement is to make this field required in order to enforce the technician to fill in the newly showed field. In this guide we will focus on the second requirement.


> ⚠️ Please be aware that it’s highly recommended to be familiar with the JavaScript Object Notation (JSON) language. And you need to be able to use the “configuration editor”. (Click [here](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/4940759092/What+is+the+configuration+editor) for more information about the configuration editor)

## \uD83D\uDCD8 Instructions

> ⚠️ Make sure that the fields you are querying are present in the** ‘briefcase’**!

> ⚠️ Please be aware of the fact that the configuration is **CASE-sensitive!** In other words, writing **“Follow_Up”** will not result in the same outcome as **“FOLLOW_UP”**.

> ⚠️ When using the validation on a field, this field can’t be of field type ‘**number’**, the JSON validation language doesn’t support this. Please use a field of '**Text' **type instead, just to be safe.

For the purpose of this guide, we will follow the use case requirements described in the example above.

1. In the configuration Editor, search for the latest configuration and clone the latest configuration.
2. Copy the entire JSON file from the configuration and paste it in a tool such as Visual Studio Code. (makes the file easier to read and edit)
3. Search for below snippet (standard TSO5) in your configuration.
  
4. From the snippet above find this piece of code in your configuration, we will be using this as an example (template) to create our own line of code to make our field required.
  
  Notice that in row 10 (in the JSON below) there is nothing between the brackets []? This is where we need to add our code to make the field required in Swift.
  
5. The code you need to add would look something like this (based on your own criteria):
  Explanation of the code:
  
6. Original piece of JSON:
  New JSON:
  
7. **Upload** the **entire** updated configuration in the configuration editor.
8. **Activate** the new configuration and assign it to the technician(s).
9. Let the technicians either perform a hard reset or let them log out and back in. In order for them to make use of the updated configuration.

## End Result:

The end result for this specific use case would be:

![image](media://c97c09cc-5970-41e6-a20b-4263a584f01d)

### How to add more fields to the same validation Rule?

1. In order to add 1 or more fields to the same validation, you can simply add this by using the below code.
  
2. This should for example look like this:
  
3. Original Config:
  New Config:
4. **Upload** the **entire** updated configuration in the configuration editor.
5. **Activate** the new configuration and assign it to the technician(s).
6. Let the technicians either perform a hard reset or let them log out and back in. In order for them to make use of the updated configuration.
7. This would look like this in Swift:

## \uD83D\uDCCB Related articles



> Macro (contentbylabel)