{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":5271,"path":"conversational-interfaces/virtual-agent/va-lookup.md","title":"Lookup utility","bundle":null,"doc_type":null,"release":"australia","body":"\n# Lookup utility\n\nUse the Lookup utility in a Virtual Agent topic to return a ServiceNow record query.\n\n## Lookup utility properties\n\n<table id=\"table_nff_y1b_3db\"><thead><tr><th>\n\nProperty\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nNode name\n\n</td><td>\n\nThe name that identifies this Lookup utility node in the topic flow.\n\n</td></tr><tr><td>\n\nVariable name\n\n</td><td>\n\nThe variable that stores the record returned by the script. The variable name is automatically created from the Node name property.\n\n</td></tr><tr><td>\n\nTable\n\n</td><td>\n\nThe table used for the query.\n\n</td></tr><tr><td>\n\nFilter this table by using\n\n</td><td>\n\nThe query to retrieve the record. Use the condition builder or a script to specify a query condition.\n\n</td></tr><tr><td class=\"sub-head\" colspan=\"2\">\n\nAdvanced\n\n</td></tr><tr><td class=\"sub-head\" colspan=\"2\">\n\nHide this node\n\n</td></tr><tr><td>\n\nConditionally show this node if\n\n</td><td>\n\nNo-code condition statement or low-code script that specifies a condition for presenting this node in the conversation. The condition must evaluate to true.\n\n</td></tr></tbody>\n</table>## Example Lookup utility\n\n\\[Omitted image \"LookupExample.png\"\\] Alt text: Lookup utility properties include a node name, the table to query, and conditions to filter the results of the lookup.\n\n## Example Lookup script\n\n```\n(function execute(table) {\n\n       var now_GR = new GlideRecord(table);\n       gr.addEncodedQuery('active=true');\n       gr.setLimit(1);\n       gr.query();\n       if(gr.next()) {\n          return gr;\n    }\n})(table)\n\n```\n\nIn this example, a table is queried for the first active record. The table to be queried is defined in the **Table** property found in the lookup utility control. The `setLimit()` method ensures that only a single record is returned from the database. If a record is found, it is returned. For more information on GlideRecord queries, see [Querying tables in script](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/api-reference/scripts/c_UsingGlideRecordToQueryTables.md) .\n\n**Parent Topic:**[Assistant Designer utilities](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/conversational-interfaces/virtual-agent/va-utilities.md)\n\n"}}