Create conditional attributes in insight cards
Last Update: Sep 2024 • Est. Read Time: 4 MINConditional attributes allow you to simplify screen views for agents by only showing attributes that are relevant to their current conversation. This works by requiring an attribute selection to be made for the next attribute to appear.
If no attribute is selected or an attribute is selected that doesn't require further information, then those fields will remain hidden.
For example, if an organization has a Contact Reason card with a multi-level list that your agents use to add details about the conversation could result in a long list for agents to scroll through to fill out. Instead, using conditional attributes you can reveal further attribute options based on if the previous attribute was filled out as the agent works through the card.
Who can access this feature? | |
User types | Admins can create conditional attributes. Users with access to the specific attribute via a permission set can see the field. |
In this article
Create conditional attributes
You can make attributes in an Insights Panel Details or Insights Card a conditional attribute that displays based on if another attribute in this view is set. You can create conditional attributes in cards that are built using the visual builder, or in the code editor under the Conditions tab. Learn more about setting up conditions in the code editor in Kustomer Developer Portal: JSX in Kustomer.
In this example, we are going use the visual builder to add 3 custom attributes to a card for Country, Region, and City and set the following conditions:
- Only show the Region attribute if the Country attribute is set to USA.
- Only show the City attribute if the previous attribute Region is filled out.
To create conditional attributes in the visual builder:
- Go to Settings > Platform > Klasses.
- Select the Klass you want to create conditional attributes in. For this example, we will use Conversation.
- Select the Insight Cards tab and then either select an existing visual builder card or create a new one. For this example, we are going to click Editon an existing Insights Panel Details card.
- Drag attributes from the Attributes panel on the left that you want to use to the center space in the editor. Here, we will use Country, Region, and City.
Select Region and then select the Set conditions for attribute check box in the Attributes panel on the right.
Note: The Set conditions for attribute check box will only appear for custom attributes and select attributes that allow for conditional conditions to be set.
- To create the condition that needs to be met for the Region attribute to display, select your choices from the drop-down menu. In this example, we only want to show this attribute if an agent enters
USA
in the Country attribute. Using the drop-down menus and text box, enter Country Equals USA. - Next, select the City attribute and select the Set conditions for attribute check box.
- Since we want this attribute to show when a value is entered in Region, select Region and Has Any Value from the drop-down menus.
- Select Save Changes > Save to confirm the action.
When you view your Insights Panel Details card, you'll notice that the Country attribute is the only one visible by default. Once you fill it out with the value we specified, USA, the Region attribute appears and so on.
Note: If an agent doesn’t have access to view a specific attribute through field level permissions, they aren't able to see the attributes in the card.
Set a conditionally required attribute
If you want to make sure agents always enter specific information, you can set a conditional attribute to be required before marking a conversation as done.
Notes:
- Conditionally required attributes are only available for an Insights Panel Details card in the Conversation klass.
- Only custom attributes can be set as a conditionally required attribute.
Let's build on our previous example that displays the Region and City attributes only if the previous attribute is set. Here, we want to make sure that agents are filling out all of these attributes for customers in the USA. To do so, we can set these conditional attributes to be required before a conversation can be marked done.
- Go to the Insights Panel Details card in your Conversation klass.
- Select the Region attribute and then select the Require this attribute to mark conversation done check box.
- Repeat this step for the City attribute.
Tip: You can hover over theicon to view the conditions for an attribute. - Select Save Changes > Save to confirm this action.
When viewing the card, you'll notice that conditional attributes that are required to be marked done are marked in red to indicate that they must be filled out.
Notes:
- Conditionally required attributes are only required to mark a conversation as done if the attribute it depends on is filled out. For example, if the Country attribute is left blank, you can close the conversation without having to enter data in the Region and City attributes.
- All conditionally required attributes are validated in the Insight Panels Details card and the Required Attributes for Completion window (front end) and not through the API (back end), which means that conditionally required attributes aren't validated in workflows or business rules that mark conversations done. Let's say you have a business rule that marks a conversation done if Country is set to USA. The business rule will close this conversation regardless of whether Region and City are filled out since these attributes are only conditionally required on the front end.
If you attempt to mark a conversation done without entering data into a visibly required attribute, a window opens alerting you to the fact that there are incomplete required attributes. You can enter data for them directly from this view. If you have multiple conditional attributes set as required, they will appear in this window as you enter data for the attribute it's dependent on.