Adding a new query using Query Editor (Legacy)
Adding a new query
Adding a new query starts from the Data tab on the right pane. In the Queries section of the 'Data Source', click on the plus icon (+) next to the Queries heading. From the New Query box:
Enter a name for the variable that holds the query results (var)
The select attribute is where you enter the SOQL statement to retrieve the needed data. Open the Query Editor by pressing on the 3 dots icon.
![image-20240109-093854.png](../__attachments/160006358/image-20240109-093854.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
Introducing the Query Editor
The Query Editor contains:
Salesforce objects & fields: List of Salesforce Objects, Related Objects and fields
Selected fields: List of fields will be used in the query
Query: The SOQL syntax
Test Query: The result when you click Test Query button
![image-20240109-093902.png](../__attachments/160006358/image-20240109-093902.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
Selecting Salesforce objects and fields
Select the Objects you want to query data in Salesforce objects & fields section to see a list of fields in the object.
Preferred fields to related objects are included and indicated with an arrow. Select the preferred field to open the related object
![image-20240109-093908.png](../__attachments/160006358/image-20240109-093908.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
Select the arrow next to object's name to navigate to the previous object
![image-20240109-093914.png](../__attachments/160006358/image-20240109-093914.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
When fields are selected, the field API name will be populated to the Selected Fields section
![image-20240109-093921.png](../__attachments/160006358/image-20240109-093921.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
Completing the SOQL syntax and testing query
When fields are selected, the SOQL Syntax is also populated
![image-20240109-093927.png](../__attachments/160006358/image-20240109-093927.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
Complete the SOQL syntax with WHERE, ORDER BY or other query options to gather the data you need. You can use dynamic content taken from the template as the conditions. See examples in Sample Query Library
Click Test Query to revise the result
If you use the dynamic data as the condition, the Test Query will prompt error but it doesn't affect to the final result.
Editing an existing query
After a query is added, its name (var value) will be shown in the Queries list under Data Source on the right pane. If you would want to edit an existing query (for example to add more fields or conditions), navigate to the query name in the list and click on the location icon.
![image-20240109-093942.png](../__attachments/160006358/image-20240109-093942.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
You will be led to the Advanced UI, where the template logic is declared. The chosen query is highlighted in light blue and can be edited on the right pane.
![image-20240109-093948.png](../__attachments/160006358/image-20240109-093948.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
When you have finished editing the query, clicking on '</> Basic UI' button on the top right corner of the screen will take you back to the Basic UI.