

# Customize the guide

The stack's views are customer-managed views. You edit them in the UI builder: standard components, such as the account's **Account phone** and **Billing city** fields, take a dynamic value, and the Customer information heading, the Recent cases rows and the Contacts rows are template string components, which you change by editing their expressions. Common changes, and where each is made:


**Changes to the account and case guide**  

| To | Change | 
| --- | --- | 
| Rearrange the screen, or show a field the guide already reads but doesn't show, such as the account's owner or a recent case's owner (`Owner.Name`) | The view only, in the UI builder or with the Connect assistant. See [Build views with the UI builder](no-code-ui-builder.md) and [Use the Connect assistant in the UI builder](connect-assistant-ui-builder.md). | 
| Show another field or record, including fields of your custom objects | In your copy of the guide flow, add an External Tool block before the view's **Show view** block that calls `getRecord` with the object's API name, the record ID and a `fields` list, copy the values you need into contact attributes, and pass them to the view under a key of your own in the **Show view** block; then show them in your copy of the view. See [Example: add your own Salesforce operations](real-time-data-integration-salesforce.md). | 
| Write a Task, a custom object or a custom field | Call the target's `createRecord` or `updateRecord` operation with the object's API name, such as `Task` or `Shipment__c`, and the fields to write; see [Example: add your own Salesforce operations](real-time-data-integration-salesforce.md). | 
| Add an operation the Salesforce target doesn't have | Add an OpenAPI or AWS Lambda target that describes it; see [Connect another system with an API](real-time-data-integration-rest.md). | 
| Add another system, such as orders | Add a target for it to the same gateway, and call it from the guide flow. | 
| Use other case statuses | Your org's Case Status picklist. The guide reads the API names of the first 10 statuses, in sort order, and Update case offers those 10. | 
| Show a different guide per queue or customer type | Your inbound flow: branch with a **Check contact attributes** block before the **Set event flow** block. | 

The guide's tool calls work within these limits:
+ Each call is synchronous, with an 8-second limit.
+ A result over 32 KB takes the block's error branch.
+ Each call replaces the previous call's result, so copy any value you need later into a contact attribute.

For time limits, asynchronous calls and retries, see [Flow block in Connect Customer: External Tool](external-tool.md). For writes you add, use an operation that is safe to repeat, such as an upsert by external ID.

The stack creates the guide's views and flows. An update that changes one of the stack's views or flows writes it from the template, which discards changes made to it in the Connect Customer console, in the UI builder or with the Connect assistant. Any 1.x update can change any of them, so make your changes on copies under your own names.

**To customize the guide on a copy**

1. Copy each view you change. To change the account view, copy both `{{stack-name}}-view-main` and `{{stack-name}}-view-main-batched` and make the matching change in both, because the guide shows the second one after **Create case**, after **New customer** creates a first case, and after a **Save** in Edit customer or Edit contact. The batched view reads the same data at different positions; the table of the batched view's paths shows each one. Expand *The view copy script*, which follows these steps, copy it, and paste it at the prompt in your instance's Region. It asks for the instance's Region, the instance alias, the stack's view, such as **connect-sf-real-time-view-main**, and a name for the copy, then creates the copy as a published view and prints its ARN.

1. Copy the guide flow, the stack's flow whose name ends in `-account-360-guide`: create a flow of the same type under your own name, and copy every block of the stack's guide flow into it; see [Copy and paste flows in Connect Customer](copy-paste-contact-flows.md).

1. In your copy of the guide flow, open each **Show view** block that shows a view you copied, choose your copy of the view, and publish the flow.

1. In your inbound flow, and in any flow that hands contacts to agents after the stack's AI self-service flow, set the **Default flow for Agent UI** event to your copy of the guide flow, and publish it. The stack's inbound flow and AI self-service flow keep setting it to the stack's guide flow, so contacts routed through them show the stack's guide.

1. Make your changes to your copies, in the UI builder or with the Connect assistant, as the following procedures describe, and test them with a test chat or a test call.

## The view copy script
<a name="real-time-data-integration-code-view-copy-script"></a>

```
(
  umask 077; D=$(mktemp -d); trap 'rm -rf "$D"' EXIT
  R=${AWS_REGION:-us-east-1}
  printf 'Region of your Connect Customer instance [%s]: ' "$R"; read -r REGION; REGION=${REGION:-$R}
  printf 'Instance alias: '; read -r ALIAS
  ID=$(aws connect list-instances --region "$REGION" --query "InstanceSummaryList[?InstanceAlias=='$ALIAS'].Id" --output text | grep -m 1 .)
  [ -n "$ID" ] || { echo "No instance named $ALIAS in $REGION; nothing was created."; exit 1; }
  printf "The stack's view to copy [connect-sf-real-time-view-main]: "; read -r VIEW; VIEW=${VIEW:-connect-sf-real-time-view-main}
  printf 'Name for your copy [%s-copy]: ' "$VIEW"; read -r NAME; NAME=${NAME:-$VIEW-copy}
  VID=$(aws connect list-views --region "$REGION" --instance-id "$ID" --type CUSTOMER_MANAGED \
    --query "ViewsSummaryList[?Name=='$VIEW'].Id" --output text | grep -m 1 .)
  [ -n "$VID" ] || { echo "No view named $VIEW in $ALIAS; nothing was created."; exit 1; }
  aws connect describe-view --region "$REGION" --instance-id "$ID" --view-id "$VID" \
    --query 'View.Content.{Template: Template, Actions: Actions}' --output json > "$D/content.json" || exit 1
  aws connect create-view --region "$REGION" --instance-id "$ID" --name "$NAME" --status PUBLISHED \
    --content "file://$D/content.json" --query View.Arn --output text
)
```

Your copies still call the stack's flow modules by their `v1` aliases, so a stack update can change what your copies do, and deleting the stack breaks them. To keep behavior of your own, call modules you build, as in [Extend the guide with flow modules](real-time-data-integration-modules.md).

Each view reads the data that the guide flow's **Show view** block passes to it, under short keys. A dynamic field in the UI builder refers to a value by its path under the key. In the stack's account view, Customer information is a loop over `$.R.compositeResponse[0].body.records`, and each field inside it uses a path relative to the record, such as `/.Phone`. The following table lists the keys of the main view, `{{stack-name}}-view-main`.

The guide shows the same account view from a second view, `{{stack-name}}-view-main-batched`, after **Create case**, after **New customer** creates a first case, and after a **Save** in Edit customer or Edit contact. It has the same keys, but its `R` is the Composite response of the write, so the same data sits at different positions:


**Paths of the main view and the batched view**  

| Data | Main view (`view-main`) | Batched view (`view-main-batched`) | 
| --- | --- | --- | 
| The account, its cases and contacts | `$.R.compositeResponse[0]` | `$.R.compositeResponse[2]` | 
| The named case | `[1]` | `[3]` | 
| The org's case statuses | `[2]` | None | 
| The account's case counts | `[3]` | `[4]` | 
| The write and its read-back | None | `[0]`, `[1]` | 

A dynamic field copied unchanged from the main view shows the wrong data.

The main view's keys:


**Data keys of the main view**  

| Key | What it holds | Example path | 
| --- | --- | --- | 
| `R` | The Read the account module's result, in `compositeResponse`: `[0]` the account with up to six of its other cases, open cases first and then the newest, and its five newest contacts; `[1]` the case in the `foundCase` attribute; `[2]` the org's first 10 case statuses by sort order; and `[3]` the account's open and closed case counts | `$.R.compositeResponse[0].body.records[0].Name`, the account's name | 
| `U` | Fixed values that the stack's guide sets on the account view: `Case` and `Kind` are `none`, `Status` and `Number` are empty, and `Comment` is `no`. The result of an Update case **Save** is in the case view's `U`. | `$.U.Kind`, which is `none` | 
| `NC` | The number of the case the agent just created, or `-` | `$.NC` | 
| `N` | The search note to show (`Note` and `Text`), and whether the search card opens expanded (`SO`) or collapsed (`SC`) | `$.N.Note`, such as `nocase` | 
| `FV` | Where the account came from: `contact` for the contact's attributes, otherwise a search | `$.FV` | 
| `SW` | How the account was found, for the banner: `From`, the number of matches `N`, the search `By`, the value `V` and the matched contact's ID `C` | `$.SW.By`, such as `CaseNumber` | 
| `IC` | The status icons, as images | `$.IC.positive` | 

The case view's keys:


**Data keys of the case view**  

| Key | What it holds | Example path | 
| --- | --- | --- | 
| `R` | The Read a case module's result, in `records`: the case's fields, its contact's name, email and phone, its account's details, and its four newest comments, four newest emails and six newest files, one more of each than the case view shows, so that it can show **(3\+)** or **(5\+)**; a trimmed read has no description and none of these lists | `$.R.records[0].CaseNumber` | 
| `T` | Whether the read was trimmed (`Trimmed`) or full (`Full`), and whether Update case is offered (`CanUpdate`) | `$.T.CanUpdate` | 
| `U` | The result of the last Save: `Nothing`, `Refused`, `Kind`, `Status`, `Number` and `Comment` | `$.U.Status` | 
| `W` | `Result`, which the stack's guide sets to `none` | `$.W.Result` | 
| `V` | Why this case is shown (`Why`), such as `contact` or `search` | `$.V.Why` | 
| `S` | The org's case statuses for the status list, `V0` to `V9`, and which of them to show, `Show1` to `Show10` | `$.S.V0` | 

The find views, **Customer not found** and its version with **New customer**, read these keys:


**Data keys of the find views**  

| Key | What it holds | Example path | 
| --- | --- | --- | 
| `N` | The note to show (`Note`), the contact's ID (`Contact`), the account already shown (`Open`), and whether the search and customer cards show (`FC`). `FC` is `true` on every find view except the one with **We couldn't look up this contact's record**, after your own Find the record module fails, where it is `false` and the cards are hidden | `$.N.Note` | 
| `CC` | The contact's channel, from the `customerChannel` attribute | `$.CC` | 
| `CN` | The caller's number, from the `customerPhone` attribute | `$.CN` | 
| `NV` | On the find view with **New customer**, after a failed create: the values the agent entered in the form, which fill it again | `$.NV.ncname` | 
| `NR` | On the same view: the Create a customer module's result, with Salesforce's error | `$.NR.compositeResponse[0].body[0].errorCode` | 

The possible matches view reads these keys:


**Data keys of the possible matches view**  

| Key | What it holds | Example path | 
| --- | --- | --- | 
| `M` | The matches, in `records`, or in `searchRecords` for a name, phone or email search: the Find the customer module's result, or the guide's read of the accounts the Find the record module returned | `$.M.records` | 
| `Q` | The value the agent searched for | `$.Q` | 
| `RV` | `yes` when the stack uses your own Find the record module, otherwise `no` | `$.RV` | 

The All cases view reads these keys:


**Data keys of the All cases view**  

| Key | What it holds | Example path | 
| --- | --- | --- | 
| `R` | The List cases module's result, in `compositeResponse`: `[0]` a page of up to ten cases, open cases first and then the newest; `[1]` the account's open and closed case counts | `$.R.compositeResponse[0].body.records[0].CaseNumber` | 
| `LO` | The number of cases before this page, from the `listOffset` attribute | `$.LO` | 
| `IC` | The status icons, as images | `$.IC.positive` | 

The edit views are **Edit customer**, **Edit contact** and the kept view, which shows a refused save again with the values the agent entered. They read these keys:


**Data keys of the edit views**  

| Key | What it holds | Example path | 
| --- | --- | --- | 
| `R` | In **Edit customer** and **Edit contact**: the Read the account module's result, as in the main view. **Edit customer**'s boxes read the account with paths relative to the record, such as `/.Name` and `/.LastModifiedDate` | `$.R.compositeResponse[0].body.records[0].Contacts.records[0].LastName` | 
| `S` | In **Edit contact**: which Contacts row the screen edits, `Show0` to `Show4`. In the kept view: whether it edits the account (`A`) or a contact (`C`) | `$.S.Show0` | 
| `NR` | In the kept view: the Update a record module's result, with its `reason` or Salesforce's message | `$.NR.compositeResponse[0].body[0].message` | 
| `K` | In the kept view: the values the agent entered, `Name`, `Phone`, `BillingCity`, `FirstName`, `LastName` and `Email`, with the record's ID (`Id`), its name when the screen opened (`RecName`) and its last modified date as read (`At`) | `$.K.LastName` | 

## Edit a view in the UI builder
<a name="real-time-data-integration-views-builder"></a>

1. Log in to the Connect Customer admin website with an account that has the **Channels and flows - Views** permission.

1. Choose **UI Management**, **Views**, and open your copy of the view, for example **connect-sf-real-time-view-main-copy**.

1. Change the layout on the canvas. To show a value from your system, select a component, and on the **Properties** tab choose the dynamic icon (the lightning bolt) to fill it at runtime. See [Build views with the UI builder](no-code-ui-builder.md).

1. Choose **Save**, and then **Publish**. Only published versions appear in the **Show view** block. The stack's guide flow names each view without a version, so it shows the latest published version. If your copy of the guide flow names a view version, choose the new version in its **Show view** block and publish the flow.

1. Check the view with a test chat or a test call; see [Test the guide with the inbound flow](real-time-data-integration-start.md#real-time-data-integration-test-chat).

## Edit a view with the Connect assistant
<a name="real-time-data-integration-views-assistant"></a>

You need the **Channels and flows - Views** and **AI agent designer - AI agents** permissions, and the Connect assistant enabled on your instance. See [Use the Connect assistant in the UI builder](connect-assistant-ui-builder.md).

1. Open the view in the UI builder, as in the previous procedure.

1. Choose **Connect Assistant** in the toolbar.

1. Describe the change, for example **Show each open case's priority on its card**.

1. Review the change on the canvas, and check that each dynamic field refers to a key that the guide flow's **Show view** block passes, from the data key tables in [Customize the guide](real-time-data-integration-adapt.md).

1. Choose **Save**, and then **Publish**, and test the view.