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

# Intro

In this guide, I’ll explain how you can make a field visible when a specific other field has a certain value. It can be done everywhere where [FProperties](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/4350672933) component is being used (so for example [Work Order Details screen](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5259100161), [Work Order Closure Screen](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/3117941144), and other - list of all screens are here - [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/3107914305](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/3107914305) )

For this example, the Work Order Closure screen will be used.

Use case will be the following - when  a technician sets the closure status of a Work Order to be  `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.

> ⚠️ 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

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

> ⚠️ Make sure that the fields you are querying are present in the** ****[briefcase](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5367365675)**!

> ⚠️ 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”**.

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 an appropriate FProperties component within a Work Order Closure Plus screen.  
`"name": "WorkOrderClosurePlus"`  
`config:propertiesLayout`  
It should look similar to the following
  
4. Within the snippet from step 3 find this piece of code:
  After this piece of code you’ll need to insert the field(s) you want to show based on the** “formula”** in the above snippet. So in this case we want to show a field with the API name** **
  
  More information about conditional rendering can be found in documentation [here](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5250023575).
5. The code you need to add is would look something like this (based on your own criteria):
  Explanation of the code:
  
6. Original 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).

### End Result:

The end result for this specific use case would be: 

![image](media://f8f1bc03-0bb1-4965-a991-7dcdd61ffa91)

![image](media://5c94f06f-0113-4a54-9898-34032ec026cd)

### How to add more fields to the same visibility condition:

> ⚠️ Proceed with caution: bear in mind that if you add more fields to the visibility condition that you remove their respective properties, as shown in the below snippet. Otherwise, you’ll duplicate the field, making one field visible on condition and the other will be shown regardless.

1. In order to add 1 or more fields to the same condition, you can simply add this by using the below code.
  
2. This should 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:

![image](media://67d8ac3d-8764-4ad1-bc9e-56f0a5fee754)

```json
{
    "headless": true,
    "iconName": "md-briefcase",
    "iosIconName": "ios-briefcase",
    "mapping": "FIELDBUDDY__Work_Order__c",
    "title": "${FIELDBUDDY__Work_Order__c.FIELDBUDDY__Comments_from_Technician__c.label}",
    "objects": [
        {
            "name": "FIELDBUDDY__Comments_from_Technician__c"
        }
    ],
    "table": "FIELDBUDDY__Work_Order__c"
}
```

## \uD83D\uDCCB Related articles

- [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/4350672933](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/4350672933)
- [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/3107914305](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/3107914305)
- [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5250023575](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5250023575)

> Macro (contentbylabel)