logo

NJP

Flow generation - quick start and prompting guide

New article articles in ServiceNow Community · Nov 07, 2024 · article

## Install and activate Flow generation

Refer to the installation instructions on the docs site ([docs.servicenow.com](https://docs.servicenow.com/csh?topicname=configuring-flow-assist.html&version=latest)) on how to install and configure Flow generation.


Once installed and the skill activated in Now Assist Admin console, users will require the **now.assist.creator** **role**. Users with this role will now have the **Build with Now Assist** option when creating a new Flow.

## Using Flow generation

Before referencing this guide, it's recommended you review the official ServiceNow documentation ([docs.servicenow.com](https://docs.servicenow.com/csh?topicname=flow-generation.html&version=latest)). These docs provide a great overview of the capability and offer a great explanation of an example prompt in addition to other useful details. This guide is aimed to go deeper and provide additional best practices, use cases, and insight into the Flow generation process so that you can best leverage this skill.


## General guidelines

These tips are included in the official docs but are critical to understand in order to get the most out of Flow generation.

* Always describe the trigger first. Describe the type of trigger and its data conditions first. After the trigger, describe the actions and flow logic in the same order that you want them to be in the flow.
* Avoid spelling errors. Avoid misspelling the names of actions, flow logic, or tables.
* Be precise and descriptive in your request. Make sure that your request is precise and descriptive. Describe the flow trigger, record data, actions, and flow logic in as much detail as you can.
* Be succinct and direct in your request. Start by specifying whether you want to generate a flow or a subflow. For example, use the phrase, "Create a flow that" to generate a flow. Describe each step the flow in order.
* Refer to actions, flow logic, and tables by name. Use action, flow logic, and table names as part of your directions. The closer your directions are to the actual names, the easier it is for the LLM to recognize them. For example, use the text for each or do the following in parallel to refer to those specific flow logic options.
* Use numbers to distinguish the branches of do the following in parallel flow logic. Add a number to each parallel branch. For example, the directions, "When a P1 incident is created, do the following in parallel: 1\. Log its short description and 2\. Look up the user assigned to it and send an email," makes it clear that there are two branches.
* Use quotation marks to set exact values. Enclose exact data values in quotations marks to help the LLM distinguish between operation names and data values. For example, the directions, "Log the value, 'incident reopened'" make it clear that the text "incident reopened" is a data value.

## Additional best practices

* Focus on prompt quality and try to limit spelling errors as noisy text hinders quality
* Use hashtags to increase the chances of populating the table correctly
* Prompt succinctly by getting right to your automation idea without an intro sentence or paragraph. Try starting with “Create a flow that ...” where you outline the main logic you want your flow to contain.
* Use quotation marks if you would like values to be copied verbatim (e.g. a log message). Both single and double quotes work. Make sure to close your quotes.
* Be explicit when writing Parallel Flow logic. It’s best to write the text in such a way that it’s clear what groups of actions are meant to be executed in parallel. For example:
* “When a P1 incident is created, do the following in parallel: 1\. Log its short description and 2\. Look up the user assigned to it and send an email”
* Be explicit when writing For Each logic. For example:
* "When the assignee of an incident changes, look up all other incidents assigned to this user. For each incident, log its name"
* If you're not able to get result from your initial try, add the word "flow" somewhere in the prompt, such as “Create a flow that begins when ...”

## #Hashtags

The new hashtag support in Flow generation allows you to explicitly reference table names, allowing you to get better generative output, especially when working with custom tables. To use this capability, enter text like "#task" in your prompt and select the table of your choice.

Keep the following in mind to get the most out of this capability.

* Hashtags are not mandatory. There's a good chance that a reference to a specific table in your prompt will yield the appropriate results. Hashtags can help when you're unable to get the correct table or when working with ambiguous table names.
* Hashtags work using display names. If you already know the system name, you can use that in your prompt without a hashtag.
* Today, hashtag only works with table names, in the future we plan to support columns request name, etc.
* Hashtags help with tables that share the same name. For instance, if you want to reference imp\_user instead of sys\_user but can't remember the exact system name, you can use #user and select the desired table from the list. Another example is group where you might want to specifically reference sys\_user\_group or cmdb\_group.
* Hashtags help with tables when their label and value are very different. For example, if the Table Label is Strategic Priority, and the Table Name is sn\_gf\_strategy, LLM might be struggling to find the correct table if you just use "Strategic Priority" without hashtags
* Hashtags are limited by the application of the flow. If a user doesn't have read access to a table due to application restrictions, then they will not be able to hashtag that table.

## Retrieval Augmented Generation (RAG)

The RAG capability of Flow generation provides instance awareness, allowing you to reference your custom actions and subflows in prompts. Consider the following to best leverage RAG in your prompts:

* RAG indexes your custom actions & sub-flows periodically, meaning recently created objects may not show up in generated Flows right away. This indexing process occurs every few hours.
* The retrieval table/columns/action/subflow is just-in-time and is not used or stored for any other instance or purpose.

## Unsupported actions

Please note that Flow generation does not support all actions available in Flows. Here's a non-exhaustive list of actions that are currently unsupported, though rest assured all of these are on our roadmap.

* Scripting
* Transform functions
* Flow stages
* Flow name
* Subflow inputs and outputs
* Flow variables
* Service catalog variables: For request flows, we are not populating request variables (or request items)
* Dynamic condition “to me” examples
* Retrieval of decision tables
* Retrieval of Saved trigger

## Resources

Training: [Now Assist for Creator - Bootcamp](https://nowlearning.servicenow.com/lxp/en/app-engine/now-assist-for-creator-implementation-bootcamp-on-demand?id=learning%5Fcourse%5Fprev&course%5Fid=5983f7b247913598db63fb25126d4303)

Recorded Demos:

| Overview | Workflow Academy | Creator Toolbox |
| -------- | ---------------- | --------------- |

## Share your prompt tips below

If you've found other useful ways to leverage Playbook generation, let us know in the comments!

View original source

https://www.servicenow.com/community/now-assist-for-creator-articles/flow-generation-quick-start-and-prompting-guide/ta-p/3098832