Flow generation
Create multi-step flows with generative AI. Generate appropriate data pill values for supported flow triggers and action inputs.
Activation
Flow generation is a skill installed with the Now Assist for Creator (sn_now_creator) application. You can install this application from the ServiceNow Store website.
Benefits
- Build a multi-step flow from a flow description in Workflow Studio. Supported triggers and actions are configured with appropriate data pill values.
- See the text directions used to generate each item in your flow.
- Use standard flow design patterns.
Supported user interfaces
Access flow generation skills from the Workflow Studio user interface.
Supported trigger types
- Scheduled triggers
- Record triggers
- Created
- Created or Updated
- Updated
- Service Level Agreements triggers
- Inbound email triggers
- Service Catalog triggers
Annotations display directions used
Beginning with the Xanadu Patch 1 release, the flow generation skill displays flow annotations below each item added to the flow. The flow annotations contain the text directions that the flow generation skill used to generate the item. You can use these flow annotations to build better text directions and also receive feedback about how your directions map to specific actions, flow logic, and subflows.
This example illustrates how the flow generation skill mapped specific text directions to flow items.
| Directions | Flow item generated |
|---|---|
| runs every day at midnight | Daily trigger |
| find all the newly created problem records for the past day | Look Up Records action |
| iterate over them | For Each flow logic |
| If they are not assigned | If flow logic |
| update it to assign the problem to level 1 triage group | Update Record action |
| move the state to "triaged," | Update Record action |
| send a notification to the group | Send Notification action |
Data pill configuration for supported items
Beginning with the Xanadu Patch 3 release, the flow generation skill generates appropriate data pill values for supported triggers, actions, and flow logic. The flow generation skill updates the flow preview with data pill values as it generates them. While generating a flow preview, the system displays a check mark icon next to each item that contains generated data pill values. You can see the data pill values generated between the name of the flow component and the flow annotations containing your original text directions. The flow preview displays an animated working icon next to items that are waiting for data pill values to be generated. While the flow preview is generating data pill values, the system displays an option to stop generating the flow preview. If you stop generating the flow preview, you must either manually save and edit the flow, or edit your directions to generate another flow preview.
- 1. Completed icon
- The system displays a green check mark icon on the cards of flow components for which it has generated data pill values. These status icons are only visible while the system is generating the flow preview.
- 2. Generated data pill values
- The system displays a preview of data pill values in between the flow component name and the text directions used to generate the flow component. The system displays a preview of long data pill values. You can select a flow component to see the full data pill configuration in the properties pane.
- 3. Working icon
- The system displays an animated working icon on the current card for which it is generating data pill values. The system displays a static working icon for the flow components that have not yet generated any data pill values. These status icons are only visible while the system is generating the flow preview.
- 4. Stop generating button
- The system displays the Stop generating button while it is generating data pill values. You can stop flow generation to either manually save and edit the flow or to update the Now Assist directions used to generate your flow preview.
Hash tag support for table name references
Beginning with the Xanadu Patch 3 release, you can refer to a specific table in your Now Assist directions by typing a hash tag character and then typing either the table label or table name. As you type, autocomplete displays tables that match your entry. Add hash tag references to your directions when you want to ensure that flow generation selects the correct table for triggers or record-based actions. Hash tag references are particularly useful to help the LLM distinguish between tables that have similar or even identical labels such as the User [imp_user] and User [sys_user] tables.
- 1. Hash tag text
- The system recognizes hash tags as a reference to a table label or table name. You can type either a table label such as Strategic Priority or a table name such as sn_gf_strategy.
- 2. Autocomplete table name suggestions
- The system displays table name suggestions that match your hash tag text. You can select an autocomplete suggestion to use data from that specific table in your Now Assist directions.
- 3. Hash tag link to table
- The system displays underlined link text to the table you selected.
Retrieval Augmented Generation (RAG) support
Flow generation uses Retrieval Augmented Generation (RAG) to include the names of common and recently published actions and subflows available on your instance. Workflow Studio updates the list of common and recently published actions and subflows every hour to make them available to flow generation. You can list published actions and subflows by name in your flow generation directions.
Example prompts
Here are some examples that you can use to create flows and subflows.
- Example flow prompt 1: scheduled trigger
- You can use this prompt to create a flow with a scheduled trigger.
Create a flow that runs every day at midnight, and then find all the newly created problem records for the past day. Iterate over them. If they are not assigned, update it to assign the problem to level 1 triage group, move the state to "triaged," and then send a notification to the group.
- Example flow prompt 2: Service Level Agreement (SLA) Task trigger
- You can use this prompt to create a flow with a Service Level Agreement (SLA) Task trigger.
Create a flow with SLA trigger. Wait for 50% of the SLA, then send a notification. Next, wait for 75% of the SLA then send another notification. After 100% of the SLA is complete, do an if statement to determine if the SLA is breached or was completed.
- Example flow prompt 3: Record trigger
- You can use this prompt to create a flow with a record trigger.
Whenever a change request is created or updated where model is unauthorized demo, do the following in parallel. First, Apply change approval policy. If approvals are approved or skipped, update change request record as approved. If not, updated change request record as rejected. Evaluate the model once again. If rejected, send email. Second, Wait until active is false, disregard change request approvals and evaluate the change model.
- Example subflow prompt 4: Record input
- You can use this prompt to create a subflow with a record input.
Create a subflow that logs the name of the problem input, and then check if the last updated by person is the same as the assigned to. Output the result from the subflow output.
- Example subflow prompt 5: Approval input
- You can use this prompt to create a subflow for an approval.
Create a subflow to create a flow launcher job using the given job config sys id and workload generator parameters. If the job sys id is not empty, assign it as the job exec id subflow output. Subsequently, start the flow launcher for the created job sysid and assign subflow outputs.
- Example subflow prompt 6: Catalog tasks
- You can use this prompt to create a subflow that creates catalog tasks.
Create a subflow that for every user with an assigned laptop it sends an email stating that their operating system has to be updated immediately and sends an SMS with the instructions to do it.
These examples illustrate using hash tags to refer to specific tables.
- Example flow 7: Strategic Priority [sn_gf_strategy] and Goal [sn_gf_goal]
- Upon creation of a new #Strategic Priority, if the type is key initiative, and the start date is before the end date, check if there is any #Goal under the strategic priority record. If no goal exists, send the owner an email.
- Example 8: Transfer Order [alm_transfer_order]
- Once a #Transfer Order is updated to the stage shipment preparation, check that there is a value in the to stockroom field. If it is not empty, create a new transfer order line and link it to the triggering transfer order record.
- Example 9: Assessment Metric type [asmt_metric_type]
- Everyday at 7pm, check if there are new #Assessment Metrics Type records that are live feed. For each of them, if the pagination setting is category, then add the assessor role to the assessment manager user.
- Example 10: Test Suite [sys_atf_test_suite] and Test [sys_atf_test]
- When a new #Test Suite record is created or updated, check if there are any child #Test records within it. If there are none, then set the Active field to false.
Placeholder steps
General guidelines
- Always describe the trigger first
- Describe the flow 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. Consider using hash tags to avoid making mistakes with table names.
- 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. For table names, consider using hash tags.
- Review the generated flow outline and input values
- Review each action, flow logic, and subflow in the generated flow outline. Review the generated inputs values to confirm that they contain relevant data references.
- Use hash tags to refer to data in a specific table
- Use a hash tag to select a specific table name. Hash tags are particularly useful to distinguish between tables that have identical or similar display names such as the User [sys_user] and User [imp_user] tables.
- 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.