VaranAwesomenow
Mega Sage

In this blog post, we'll guide you through navigating and managing virtual agent topics using GML (Graph Modeling Language). We'll cover how to navigate to a virtual agent, the challenges of managing large topics, and how GML can help address these challenges. We'll also explain the graph column on topic helps us see json version of topic, scoped app code, and more. Let's dive in!

 

How to Navigate to Virtual Agent and See a Virtual Agent Topic

To get started, you'll need to log into ServiceNow platform. Once logged in, navigate to virtual agent designer

VaranAwesomenow_0-1740895720384.png

 

Here, you can see the various topics search for a topic (Download Payslip) and click on a topic to view its details.

VaranAwesomenow_0-1740895778502.png

 

Challenges in Seeing a Large Topic in Virtual Agent Designer

One of the challenges in the virtual agent designer is managing large topics. When a topic becomes too large, it can be difficult to visualize and manage, while there is an option to see in tabular view it still can become challenging to see entire topic block on a page and understanding it. This is where this solution comes in.

VaranAwesomenow_1-1740895867243.pngVaranAwesomenow_2-1740895889788.png

 

 

How GML Can Help in Addressing This Challenge

GML, or Graph Modeling Language, can help by providing a visual representation of the topic. This makes it easier to understand the structure and flow of the topic.

Explanation of Graph Column on Topic

The graph column on the topic contains the definition of the virtual agent topic in JSON format. This JSON data can be exported and visualized using GML. To view the json format of topic, open the topic in platform view by navigating to sys_cb_topic table. Search for the topic using name Download Payslip Request. Open the topic.

 

VaranAwesomenow_0-1740895951418.png 

VaranAwesomenow_1-1740895969185.png

 

VaranAwesomenow_3-1740896111941.png

 

Update form layout to see Graph field on the form, below is json format of the topic. Attached is complete file json file, change the extension to .json before opening it.

 

 

 

 

 

 

 

{
  "graph_api_version": "1.0.39",
  "goals": {
    "primary": {
      "id": "primary",
      "trigger": {
        "type": "primary"
      },
      "name": "primary",
      "applicability": "",
      "description": "",
      "nodes": {
        "85d79000768240bba64228e5fbdcbabe": {
          "id": "85d79000768240bba64228e5fbdcbabe",
          "stepType": "Start",
          "name": "Start",
          "greetingResponse": {
            "mode": "simple",
            "value": ""
          }
...........................
      },
      "edges": [
        {
          "id": "9aec71fc23b2482683d10fcdd03aa7e6",
          "edgeType": "Edge",
          "source": "6ba464788a534289a03091c4c0bfb2d5",
          "target": "1f7ff2fc87004e049070c7038bf0e447",
          "sourcePort": "",
          "targetPort": ""
        },
        .................
        }
      ]
    }
  },
  "variables": {
    "11eb06f0235e4810984f24bb744e4718": {
      "id": "11eb06f0235e4810984f24bb744e4718",
      "name": "LiveAgent_hr_topic_id",
      "value": {
        "mode": "simple",
        "value": "586c0d09775101104c99aa9ccd5a9912"
      },
      "varType": "script",
      "category": "vaVars",
      "label": "LiveAgent_hr_topic_id"
    }
    ................
  }
}

 

 

 

 

 

 

 

 

Demonstrating How to Generate Open and Download a GML File for a Topic

To generate GML file click on Analyze Topic GML button

VaranAwesomenow_0-1740896397299.png

File gets attached to the topic record

VaranAwesomenow_1-1740896449767.png

 

Download it to your local machine, a sample gml file can be accessed here jsonToGmlConverter/Download Payslip Request(Template)-2025-03-02 (1).gml at master · anilvaranasi/js...

Showing the Exported GML in Desktop Version of yEd

Open YED editor and open the downloaded gml file, as soon as it opens it would appear in below layout.

VaranAwesomenow_2-1740896557092.png

Navigate to layout and change the layout to Hierarchical

VaranAwesomenow_3-1740896606446.png

Leave default settings on popup

VaranAwesomenow_4-1740896661290.png

 

VaranAwesomenow_5-1740896672901.png

 

Zoom in to see the content more clearly

VaranAwesomenow_7-1740896715738.png

 

You can also see reusable topics, their topic flows and which step in the existing topic flow is calling these reusable topics

VaranAwesomenow_8-1740896838000.png VaranAwesomenow_9-1740896856465.png

 

Showing the Exported GML in Online Version of yEd

Now, let's open the exported GML file in yEd. You can use the online version of yEd

Open yEd Live and open the diagram that we have downloaded from topic by selecting open file

VaranAwesomenow_10-1740896934100.png

Update layout to hierarchical after opening the file

VaranAwesomenow_11-1740897023158.png

 

Topic flow would look like below

VaranAwesomenow_0-1740897244499.png

 

Zoom to see the topic flow more clearly, you can also download to PDF PF PDF export Download Payslip Request(Template)-2025-03-02.pdf

VaranAwesomenow_1-1740897278431.png

 

Here, you can see the visual representation of the topic. This makes it much easier to understand and manage.

How to Install Scoped App and Prerequisites

Scoped app for this solution is available on github anilvaranasi/jsonToGmlConverter. There is also an updateset jsonToGmlConverter/AVGlobalUpdatesetPreRequisite.xml at master · anilvaranasi/jsonToGmlConverter that needs to be deployed in global scope to update a system property to allow mime extension for gml file uploads.

VaranAwesomenow_0-1740914980299.png

 

How to Clean Up Attachments

Cleaning up attachments on topic can be done if needed by directly opening the attachments in sys_attachment table. 

VaranAwesomenow_1-1740915114801.png

 

Show How to Find Out Largest Virtual Agent Topic and the Fix Script

To find the largest virtual agent topic, you can use a script that analyzes the size of each topic. Once you've identified the largest topic, you can use a fix script to optimize it.

 

Feedback and Any Improvement Ideas

 

We hope you found this tutorial helpful. We'd love to hear your feedback and any ideas for improvement. Please leave your comments below.

This Solution Is Not a replacement to virtual agent designer

Finally, it's important to note that this solution is not meant to replace the virtual agent designer. It's a complementary tool to help manage large and complex topics.

 

Thank you for reading! Stay tuned for more tutorials and guides on managing virtual agents.

References

Virtual Agent Topic Block: Retrieve Choice List - ServiceNow Community

Configuring Virtual Agent

VirtualAgent.png (8049×4680)

1 Comment