# How do you build and deploy a custom LWC for the Salesforce Field Service mobile app so it works offline?

**Topic:** Field Service · **Difficulty:** Medium · **Asked at:** Accenture, Cognizant, Tech Mahindra · **Tags:** LWC, Mobile App, Offline, Quick Action

Read it on the site: https://www.forcechallenges.com/interview-questions/how-do-you-build-and-deploy-custom-lightning-web-components-lwc-for-the-salesforce-field-service-mobile-app

## Answer

Custom LWCs can run inside the Field Service mobile app as **quick actions** or on **record pages**.

**Build steps**
1. Create the LWC and expose it for the right target in `js-meta.xml`.
2. Use **Lightning Data Service** (`getRecord`, `updateRecord`, GraphQL wire adapter) so data works **offline**. Imperative Apex calls need a connection.
3. Add the component as a **quick action** (Lightning Component, screen action) to the object's layout or the mobile action list.
4. Make sure the records and fields it needs are in the **Briefcase**.
5. Deploy with the CLI or a change set, and test on a real device in airplane mode.

```xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>62.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordAction</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordAction">
            <actionType>ScreenAction</actionType>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>
```

```javascript
import { LightningElement, api, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';

export default class WoChecklist extends LightningElement {
    @api recordId;
    @wire(getRecord, { recordId: '$recordId', fields: ['WorkOrder.Status'] })
    workOrder;
}
```

**Tips:** keep the UI touch friendly, handle missing data, and use `lightning/mobileCapabilities` for barcode or location features.

---
Source: ForceChallenges · last updated 2026-10-31
