> ## Documentation Index
> Fetch the complete documentation index at: https://support.fieldko.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Flow Recipes for Field Teams

> Build common retail execution flows on FieldKo objects, such as compliance alerts, out-of-stock follow-ups, large-order notices, and visit coverage checks.

These recipes show how to automate common retail execution follow-ups with Salesforce Flow on FieldKo objects. Each recipe lists the object, trigger, entry conditions, and steps, using the labels you see in Flow Builder. Adapt the thresholds and recipients to your business.

Before you build any of them, read [Design Automation for FieldKo](/platform/automate/design-automation). Rep records arrive in batches when reps sync, so every recipe here uses entry conditions, avoids elements inside loops, and sends notifications on an asynchronous path so that a failure can't block a rep's sync.

## User Permissions Needed

| To do this | You need |
| - | - |
| Create and activate flows | Manage Flow permission |
| Add custom fields used by the recipes | Customize Application permission |

## Before You Begin

* **Decide how to reach managers.** Several recipes notify the rep's manager through the **Manager** field on the rep's user record. If you don't use that field, for example because your managers come from roles or public groups, send the notification to a public group or queue instead.
* **Create a custom notification type** if you send custom notifications. See [Notifications and Email Alerts](/platform/automate/notifications).
* **Add your bypass check.** Start each flow with the integration-user bypass described in [Bypass Your Flows for Integration Users](/platform/automate/design-automation#bypass-your-flows-for-integration-users).

## Recipes at a Glance

| Recipe | Object | Trigger |
| - | - | - |
| [Alert a Manager When a Compliance Check Fails](#alert-a-manager-when-a-compliance-check-fails) | Task Survey Answer | Record-triggered, after save |
| [Follow Up on an Out-of-Stock Product](#follow-up-on-an-out-of-stock-product) | Ranging Line Item | Record-triggered, after save |
| [Notify the Account Owner About a Large Order](#notify-the-account-owner-about-a-large-order) | FieldKo Order | Record-triggered, after save |
| [Flag Stores Not Visited in X Days](#flag-stores-not-visited-in-x-days) | Account | Schedule-triggered |
| [Notify a Manager When a Visit Is Cancelled](#notify-a-manager-when-a-visit-is-cancelled) | Visit | Record-triggered, after save |

## Alert a Manager When a Compliance Check Fails

Tell a manager right away when a rep records a failed compliance question, such as "Is the promotional display in place?" answered "No". This supports promotion compliance and planogram compliance follow-up.

FieldKo doesn't mark which questions are compliance checks, so first add a checkbox, such as **Compliance Question**, to the **Question** object, and select it on the questions you want to watch.

* **Object:** Task Survey Answer
* **Trigger:** A record is created or updated. Optimize for **Actions and Related Records**.
* **Entry conditions:** **Question Definition** is not blank.

Build the flow with these steps:

1. Add a **Decision** element that checks whether **Question Definition** > **Compliance Question** equals true and **Answer** equals `No`. Because **Answer** is a long text field, check it in a Decision element instead of in the entry conditions.
2. Optional: Add an outcome for scored surveys, where **Score Obtained** is less than your threshold. Before you rely on this, check that recent survey answers in your org have **Score Obtained** filled in.
3. On the failed outcome, add an asynchronous path, and then add a **Send Custom Notification** action. Set the recipient to **Task Survey** > **Visit** > **Sales Representative** > **Manager**, and set the target to the visit.
4. In the notification body, include the account name (**Task Survey** > **Visit** > **Account** > **Account Name**), the question, and the answer.

Use the lookup path through **Task Survey** and **Visit** to find the rep. The **Sales Representative** field on the survey answer itself is a text field, not a user lookup.

## Follow Up on an Out-of-Stock Product

When a rep records core ranging and a contracted product isn't on the shelf, create a follow-up so someone acts on the out-of-stock. Each time a rep saves ranging, FieldKo creates a new **Ranging** record with one **Ranging Line Item** per product, and the line items upload after the ranging record. Trigger on the line items, not the ranging record.

A store visit can produce many missing products at once. To keep follow-ups manageable, add a checkbox such as **Must Stock** to **FieldKo Product**, and act only on those products.

* **Object:** Ranging Line Item
* **Trigger:** A record is created. Optimize for **Actions and Related Records**.
* **Entry conditions:** **Is Present** equals false. If you use your own ranging columns, use your own out-of-stock field instead.

Build the flow with these steps:

1. Add a **Decision** element that continues only when **Product Name** > **Must Stock** equals true. (**Product Name** is the line item's lookup to the FieldKo product.)
2. Add a **Create Records** element for a Salesforce **Task** (the standard activity, not a FieldKo task). Set **Related To** to **Ranging** > **Account**, **Assigned To** to the account owner, a due date, and a subject that includes **Product Name** > **Product Name**.
3. Add a fault path that emails your admin team, so a failed task doesn't block the rep's ranging.

To put the follow-up on the next visit instead, create a **Next Visit ToDo's** record with **Next Visit Entry** child records for the task types to do. FieldKo keeps only one active to-do per account and assignee: saving a new active to-do deactivates the existing one, including one a manager created. Check for an active to-do first, and add your entries to it. The `NextVisitToDoAssigneeSchedular` job applies to-dos created in Salesforce to the next planned visit. See [Scheduled Jobs](/admin/installation#scheduled-jobs).

## Notify the Account Owner About a Large Order

Let the account owner or key account manager know when a rep places an unusually large order.

* **Object:** FieldKo Order
* **Trigger:** A record is created. Optimize for **Actions and Related Records**.
* **Entry conditions:** **Order Amount** is greater than or equal to your threshold.

Build the flow with these steps:

1. Add an asynchronous path.
2. Optional: Add a **Decision** element that skips return orders by checking the order's record type.
3. Add a **Send Custom Notification** action, or an email alert, to **Account** > **Owner ID**. Set the target to the order.

The app sets **Order Amount** when the rep places the order, so it's available when the order is created, even if some order lines upload in a later batch. To act only on orders that need sign-off, see [Approvals](/platform/automate/approvals).

## Flag Stores Not Visited in X Days

Find stores that have fallen out of coverage. FieldKo keeps these fields current on each account:

* **Last Check-Out:** The date of the last completed visit
* **Next Visit Plan Date:** The date of the next planned visit
* **Days since Last Checkout:** A formula based on **Last Check-Out**, useful in reports and list views

Build a schedule-triggered flow that marks uncovered stores:

1. Add a checkbox, such as **Coverage Gap**, to Account.
2. Create a schedule-triggered flow that runs daily on Account. Filter it to your store record types, the ones selected in **Account Record Types for Visit Planning**.
3. Add a **Decision** element with a formula outcome that's true when **Last Check-Out** is blank or more than X days ago, and **Next Visit Plan Date** is blank or in the past.
4. On that outcome, set **Coverage Gap** to true. On the other outcome, set it to false if it's currently true.

Then build a list view or report on **Coverage Gap** for managers. See [Plan Visits in Salesforce](/managers/plan-visits).

<Note>
  Updating accounts adds work to every account in the run, and FieldKo's own account automation runs on each update. Update **Coverage Gap** only when its value changes.
</Note>

## Notify a Manager When a Visit Is Cancelled

Tell a manager when a rep cancels a visit, with the reason, so call compliance problems surface the same day.

* **Object:** Visit
* **Trigger:** A record is updated. Optimize for **Actions and Related Records**.
* **Entry conditions:** **Status** equals `Cancelled`. Select **Only when a record is updated to meet the condition requirements**.

Build the flow with these steps:

1. Add an asynchronous path.
2. Add a **Send Custom Notification** action to **Sales Representative** > **Manager**, with the visit as the target.
3. In the body, include the account and the reason. Visits cancelled in the app store the reason in **Check Out Compliance Reason**. Visits cancelled in Salesforce store it in **Reason For Incompletion** and **Incompletion Remark**.

In Salesforce, cancelling a visit that's already in progress completes it instead of cancelling it. To catch those visits too, add an outcome for **Status** changed to `Completed` with **Reason For Incompletion** filled in.

## Test Your Flows

Test each recipe in a sandbox before you activate it in production:

1. Log in to the FieldKo Atlas app as a test rep in the sandbox. See [Manage Releases](/platform/data/releases).
2. Complete several visits offline, with surveys, ranging, and orders that meet and don't meet your conditions.
3. Sync once, and then check that the right notifications arrived and that the rep's sync finished without issues in [Sync Details](/admin/support-diagnostics#sync-details).

## See Also

* [Design Automation for FieldKo](/platform/automate/design-automation)
* [Notifications and Email Alerts](/platform/automate/notifications)
* [Approvals](/platform/automate/approvals)
* [Design Surveys and Tasks for Reporting](/platform/customize/design-surveys-for-reporting)
* [Retail Execution Metrics](/managers/platform/retail-metrics)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.