--- title: "Example Flow: Create Case on Low NPS" slug: "example-flow-create-case-on-low-nps" updated: 2024-11-13T15:28:43Z published: 2024-11-13T15:28:43Z canonical: "docs.relaynetwork.com/example-flow-create-case-on-low-nps" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.relaynetwork.com/llms.txt > Use this file to discover all available pages before exploring further. # Example 2: Create a Case on Low NPS NOTE This example should be used as a reference to understand basic concepts and ideas on integrating with Relay Network. It should not be taken literally as this is how integration to Relay must be done. You should replace your record types, field names, business logic, etc. with those that match your business process and setup. ## Example Goals In this example, we will monitor user responses (from the Relay Feed) related to our Company’s NPS. User responses, from the Feed, arrive as events and are stored in the [RelayEvents__c](/v1/docs/relayevents-c) custom object. If the user responds with a poor rating, we will create a new Salesforce *case* for a follow up with the user. ## Assumptions - The Relay Connected App was configured to allow Relay to push *RelayEvent__c* record to your Salesforce org. - A Relay message was sent to a specific *Person Account’s* Relay Feed. - The *Person Account* has a custom field, *RelayCCID__c*, that hold the unique CCID value for the user. - The Relay message allows the user to click on a Feed action to rate the Company. ## Security and Permissions Record triggered flows always run as the *System Context without Sharing.* This provides access to all objects and their fields. ## Flow Resources | Resource Name | Type | Description | | --- | --- | --- | | NewCase | Resource Type → Variable Data Type → Record Object → Case | If the trigger conditions are met, this resources will be populated with details and submitted to the `Create Records` action. | ## Flow ![rn-sfdc-flows-example2-flow_diagram](https://cdn.us.document360.io/6738087b-455d-402f-b70a-a44a4231547e/Images/Documentation/rn-sfdc-flows-example2-flow_diagram.png) ### (1) Configure the Start Element The majority of the flow logic all happens in the *Start Element*. - Create a **Record-Triggered Flow** on the **RelayEvents__c** record type - Set the *Configure Trigger* to **A Record is Created** - Set the following *Entry Conditions:* - *Condition Requirements* → **All Conditions Are Met (AND)** - *Field* → **TriggerID__c** → **Equals** → *Provide a valid Relay Trigger ID value corresponding to the correct Relay Message*. - Check that the **EventType__c** field refers to an experience **action**. - Check that the **ActionLabel__c** field refers to **Poorly**, which indicates the user is unhappy with us. - It is generally a good idea to put the this type of flow logic in a **Run Asynchronously Path** ensuring the *RelayEvent__c* record is always created. ![rn-sfdc-flows-example2-trigger-conditions](https://cdn.us.document360.io/6738087b-455d-402f-b70a-a44a4231547e/Images/Documentation/rn-sfdc-flows-example2-trigger-conditions.png) ### (2) Add a Get Records Element Locate the *Person Account* record using the **CCID** from the triggered event record. ![rn-sfdc-flows-ex2-get_record](https://cdn.us.document360.io/6738087b-455d-402f-b70a-a44a4231547e/Images/Documentation/rn-sfdc-flows-ex2-get_record.png) ### (3) Verify Person Account was Found Add a *Decision* element to verify the record was located. ![rn-sfdc-flows-ex2-decision](https://cdn.us.document360.io/6738087b-455d-402f-b70a-a44a4231547e/Images/Documentation/rn-sfdc-flows-ex2-decision.png) ### (4) Create a new Case Record If we found the matching record, we will create a new *Case* and assign to the located record. - Add an *Assignment* element to the flow - Populate the **NewCase** resource with the appropriate field values. ![rn-sfdc-flows-ex2-assign_case](https://cdn.us.document360.io/6738087b-455d-402f-b70a-a44a4231547e/Images/Documentation/rn-sfdc-flows-ex2-assign_case.png) ### (5) Create the new Case Record - Add a **Create Records** element to the flow - Specify the **NewCase** resource as the record to be created. ![rn-sfdc-flows-ex2-create_case](https://cdn.us.document360.io/6738087b-455d-402f-b70a-a44a4231547e/Images/Documentation/rn-sfdc-flows-ex2-create_case.png) **Net promoter score** (NPS) is a market research metric that is based on a single survey question asking respondents to rate the likelihood that they would recommend a company, product, or a service to a friend or colleague. The NPS is a proprietary instrument developed by Fred Reichheld, who owns the registered NPS trademark in conjunction with Bain & Company and Satmetrix. Its popularity and broad use have been attributed to its simplicity and transparent methodology.