Fetch data from multiple sources
Learn how to obtain data from different sources to use in a single component.
Before you begin
Role required: ui_builder_admin
About this task
Place the card base container component in a repeater and use multi-table data configuration to present all active incidents and problems created in the last two years.
Procedure
- Navigate to All > Now Experience Framework > UI Builder.
-
Open an experience to work in or create an experience by selecting Create > Experience.
See Configure how users interact with your applications in UI Builder for more information on creating experiences.
-
Create a page from scratch.
For more information about how to create a page, see Create a page in UI Builder.
-
Add a multi-table data resource.
-
In the data shelf, select + Add data resource.
- In Search, enter multi-table.
-
Select Multi-table data.
- Select Add.
-
In the data shelf, select + Add data resource.
-
Configure the first data source.
-
In Data sources, select + Add.
- In Table, enter incident and select the Incident table.
- In Sort field, enter number and select Number.
- In Name, enter Incident.
-
In Return fields, add Number, State, Description, and Active.
- Select Edit conditions.
- Build the condition Active is true.
- Select and.
-
Build the condition Created on Last 2 years.
- Select Apply.
- Select Apply.
-
In Data sources, select + Add.
-
Configure the second data source.
- In Data sources, select + Add.
- In Table, enter problem and select the Problem table.
- In Sort field, enter number and select Number.
- In Name, enter Problem.
-
In Return fields, add Number, State, Description, and Active.
When creating a multi-table data resource, each data source should have the same return fields specified and in the same order. This helps ensure that the data displayed on the page is consistent and accurate.
- Select Edit conditions.
- Build the condition Active is true.
- Select and.
- Build the condition Created on Last 2 years.
- Select Apply.
- Select Apply.
- Select the X to close the Edit Multi-table data pop-up.
- Select Save.
-
Add the heading component.
- In the content tree, select + Add content under Body.
- In Search enter heading.
- Select the Heading component.
- In the configuration panel, on the Configure tab, select None - Configure the component manually.
-
In Label, delete the default text and enter Active incidents and problems created in last two years.
- Select Save.
-
Add a container.
- In the content tree, select + Add content under Heading 1.
-
On the Layouts tab, in the Advanced section, select Flexbox.
- In the configuration panel, on the Configure tab, select None - Configure the component manually.
-
In Sizing, set the Width by entering 300.
- Select Save.
-
Add the repeater component.
- In the content tree, select + Add content under Container 1.
- In Search enter repeater.
- Select the Repeater component.
- In the configuration panel, on the Configure tab, select None - Configure the component manually.
- Select Save.
-
In the configuration panel, on the Configure tab, hover over the Data array field and select the bind data icon.
- Under Data types select Data resource.
- Select Multi-table data 1.
- Select output > data > GlideMultiDatasource_Query > getMultiDatasourceData.
-
Double-click (or use the keyboard shortcut) on the items pill.
Check that the top section is accurate.
- Select Apply.
- Select Save.
-
Add the card base container component within the repeater.
- In the content tree, select + Add content under Repeater 1.
- Locate and select the Card Base Container component.
- In the configuration panel, on the Configure tab, select None - Configure the component manually.
- Select the Styles tab.
-
To add a little space around the cards, go to Spacing, select Margin, and then select M (for medium).
- Select Save.
-
Add the heading component within the card base container.
- In the content tree, select + Add content under Card Base Container 1.
- Locate and select the Heading component.
- In the configuration panel, on the Configure tab, select None - Configure the component manually.
- In the configuration panel, on the Configure tab, delete the default text in Label.
- Point to the Label field and select the bind data icon.
- Under Data types select Repeater.
- Select value > fields.
- Select the top pill and in the last column check for displayValue with an incident or problem number.
-
Double-click (or use the keyboard shortcut) on the displayValue pill with an incident or problem number.
Check that the top section is accurate.
- Select Apply.
-
On the Configure tab, select the Hide bottom margin option.
- Select Save.
-
Add the first stylized text component to show the description of the incident or problem.
-
In the content tree, point to Heading 2, select the menu (three vertical dots) icon, and select Add after.
- Locate and select the Stylized text component.
- In the configuration panel, on the Configure tab, select None - Configure the component manually.
- In the configuration panel, on the Configure tab, delete the default text in Text.
- Point to the Text field and select the bind data icon.
- Under Data types select Repeater.
- Select value > fields.
- Select the third pill in the list and in the last column check that the displayValue contains no information.
-
Double-click (or use the keyboard shortcut) on the displayValue pill with no value.
Check that the top section is accurate.
- Select Apply.
- To reduce the text size, go to the Configure tab and change the HTML tag to Paragraph.
- Select Save.
-
In the content tree, point to Heading 2, select the menu (three vertical dots) icon, and select Add after.
-
Add the second stylized text component to show the state of the incident or problem.
- In the content tree, point to Stylized text 1, select the menu (three vertical dots) icon, and select Add after.
- Locate and select the Stylized text component.
- In the configuration panel, on the Configure tab, select None - Configure the component manually.
- In the configuration panel, on the Configure tab, delete the default text in Text.
- Point to the Text field and select the bind data icon.
- Under Data types select Repeater.
- Select value > fields.
- Select the second pill in the list and in the last column check that the displayValue contains a state such as Resolved or In Progress.
-
Double-click (or use the keyboard shortcut) on the displayValue pill with a state value.
Check that the top section is accurate.
- Select Apply.
- To reduce the text size, go to the Configure tab and change the HTML tag to Paragraph.
- Select Save.
-
Select Preview.
The page heading is at the top. Each card contains a heading with the incident or problem number. The cards also show the description (if one is available) of the incident or problem and the state. Data is being pulled successfully from two sources: the incident table and the problem table.
- Select the X to close the preview overlay.