---
title: "Briefcase"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/5367365675/Briefcase"
format: markdown
---
## What is a Briefcase

The briefcase is a part of FieldBuddy Swift Configuration that determines which kind of data is returned during sync using data exchange service and accessible locally without internet connection in FIeldBuddy Swift mobile app.

It can be changed in[ Configuration Editor](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/3094808809)

## Structure of a Briefcase

Briefcase if a JSON file, which has structure of an array of (nested) JSON objects. Below in the table there are properties of such JSON object. 

| **Property Name** | **Definition** | **Example** |
| --- | --- | --- |
| `Target` | Required, String<br>sObject name in salesforce data model, defines which records will be returned, required, i.e. FIELDBUDDY__Work_Order__c. | `"Target":"FIELDBUDDY__Work_Order__c"` |
| `Fields` | Required, Array  
Describes which fields from sObject **Target** should be returned | `"Fields":['Id','Name']` |
| `Condition` | Optional, String<br>string, which is valid SOQL filter against target sObject, i.e. `Name != null`, Optional | `"Condition":"Name != null"`  
`"Condition":"Name LIKE 'Vic%'"` |
| `RefreshCondition` | Optional, String<br>string, which is valid SOQL filter that allow to do extra filtering in case if we need to return less data during delta sync, for example `LastModifiedDate >= :newDate` , Optional | `"RefreshCondition":"LastModifiedDate >= :newDate"` |
| `Reference` | Optional, String<br>string, determines which property needs to be taken from parent Target collection to determine relation to current Target. f.e. if we get child contact for account, where relationship field is AccountId on contact, then on Account object "Id" is reference field, Optional | `"Reference":"Id"` |
| `ReferenceCondition` | Optional, String<br>string, which is valid SOQL filter against sObject to cover relationship. in case of E). it will be `'AccountId in :idList'`, Optional<br>In order for it to be working, given field has to be specified in fields on related  entity on parent level | `"ReferenceCondition":"FIELDBUDDY__Work_Order__c in :idList"` |
| `Children` | Optional, Array of Objects of current format<br>array of object of this very type, which determine <u>***RELATED***</u> (PARENT OR CHILD)  entities in salesforce data model, Optional | `"Children":[]` |
| `ReturnAttachments` | Optional, Boolean<br>Allow to return Names and other info of related attachments and Files (Content Documents) to current record in briefcase.<br>Works for Work Orders, Installed Products and Location | `"ReturnAttachments":true` |

## **Special variables**

In filtering, it is possible to use following special variables

- `:userId` - refers to current user id. Useful in filtering of Work Orders
- `:newDate` - refers to last successful sync date. Useful in `RefreshCondition`
- `:idList` - refers to IDs of related records (parent ones, can be used in `Children` entities. Useful in `ReferenceCondition`

## **Sample Briefcase**

The simplest example:

|  |
| --- |
| ```
[
  {
        "Children": [],
        "ReferenceCondition": null,
        "Fields": [
           "Id",
           "Name"
        ],
        "Reference": null,
        "RefreshCondition": null,
        "Target": "Account"   
  }
]
``` |

Above will return all account records to Swift app


Another one would be – return current user, as well as Timesheets with Timesheet line items for current user in range of +- 14 days

```
[
    {
        "Children": [
            {
                "Children": null,
                "Fields": [
                    "Id",
                    "Name",
                    "FIELDBUDDY__Comments__c",
                    "FIELDBUDDY__Start_Time__c",
                    "FIELDBUDDY__Type__c",
                    "FIELDBUDDY__Work_Order__c",
                    "FIELDBUDDY__Total_Time_Minutes__c",
                    "FIELDBUDDY__End_Time__c",
                    "FIELDBUDDY__Timesheet__c",
                    "FIELDBUDDY__Odometer_Start__c",
                    "FIELDBUDDY__Odometer_End__c"
                ],
                "Reference": "Id",
                "ReferenceCondition": "FIELDBUDDY__Timesheet__c IN :idList",
                "RefreshCondition": "LastModifiedDate >= :newDate",
                "Target": "FIELDBUDDY__Timesheet_Lineitem__c"
            }
        ],
        "Condition": "(FIELDBUDDY__User__c = :userId AND (FIELDBUDDY__Date__c = LAST_N_DAYS:14 OR FIELDBUDDY__Date__c = NEXT_N_DAYS:14))",
        "Fields": [
            "CreatedDate",
            "Id",
            "Name",
            "FIELDBUDDY__Date__c",
            "FIELDBUDDY__User__c"
        ],
        "Reference": "Id",
        "RefreshCondition": "LastModifiedDate >= :newDate",
        "Target": "FIELDBUDDY__Timesheet__c"
    },
    {
        "Children": null,
        "Condition": "(Id = :userId)",
        "Fields": [
            "Id",
            "FirstName",
            "LastName",
            "Email"
        ],
        "Reference": "Id",
        "RefreshCondition": "",
        "Target": "User"
    }
]
```

Default briefcase that is being distributed as in reference FieldBuddy Swift configuration can be found here - [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5346689039](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5346689039) 

Check follow article about limits issues - [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5267521549](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/5267521549)