Now Assist For Creator - Enablement Bootcamp Training Guide
Now Assist For Creator - Enablement Bootcamp Training Guide
2.2 Text-to-Code..................................................................................................................................................... 16
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
2
Introduction to Now Assist for Code
Solution Overview
Now Assist for Code is an umbrella application which contains multiple skills to assist ServiceNow
Developers in creating and updating applications.
As of the September 2023, Now Assist for Creator contains two skills:
• Code Assist
• Flow Assist
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
3
Workshop Objectives
Today you will be taking on the persona of ServiceNow Developer and learning how to leverage the
Now Assist for Creator skills to perform different tasks through the instance.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
4
Setup: Activate Now Assist for Creator
If you are performing this lab on a lab instance, this setup should have already been complete.
If you are doing this on your own instance (not a PDI), you need to activate Now Assist for
Creator prior to moving on to the other exercises.
Installation:
1. Go to the ServiceNow Store https://store.servicenow.com/
2. Search for Now Assist for Creator.
3. Select Opt-In.
4. Navigate to System Applications > All.
5. Search for Now Assist for Creator.
6. Select Install.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
5
Exercise 1: Configuration
1.1 Activate Skills
1. Navigate to the Now Assist Admin > Features.
2. Select Creator.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
6
4. Select Activate skill on the Text-to-code skill block.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
7
6. Select Save and continue.
7. Select Activate.
8. Navigate back to the Creator skills list. Under Flow Assist, select View details.
You have now activated the Now Assist for Creator skills.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
8
Exercise 2: Code Assist
2.1 Code Complete
Code Complete assists the developers by quickly completing the code they are working on. In
these examples, we create code in the Fix Script module, but Code Assist works in many places
throughout the platform. Check out the documentation for more information on where else you can
use Code Assist.
Note: Code Assist takes into account where your cursor is. It is very important to have the cursor in
the correct place so that it can predict the code you want to generate.
This brings up the info panel that shows you the keyboard shortcuts.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
9
Note: this is the standard list of shortcuts with no Now Assist functionality. This is what
users see if they have not been granted the now.assist.creator role.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
10
Note: The admin role does not give you access to Now Assist for Creator skills; the
now.assist.creator role is required for the skills.
Note: you must have the now.assist.creator role to see this icon.
Now that you have the now.assist.creator role, you should see new options. Be sure to
note the options for Trigger AI which differ depending on your client operating system.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
11
17. Enter the text switch(today) and move your cursor to the end of the line.
Note: The gray code is the generated code, which may vary even for the same
prompt, so your screen might be different. This variance is due to how LLMs function
as they predict the probability of the next word/token and are not deterministically
going to choose the same path.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
12
21. Select Crtl+Enter (or Cmd+Enter).
Note: this is all editable code that can be updated and refactored as needed.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
13
23. Clear out the code and complete this try statement by inputing the text up to the cursor in
the screenshot. Then, select Ctrl+Enter (or equivalent).
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
14
28. Clear out the code and complete these other code blocks by inputing the text up to the
cursor in the screenshots.
Note: your results may vary from the results shown here.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
15
2.2 Text-to-Code
With code completion, Now Assist looks at the code you wrote and finishes it. Text-to-code takes this
a step further. Simply tell it what you want to do, and it writes code to do that. Again, cursor
location is key. Be sure to have your cursor at the end of the comment.
Note: jump to step 4 if you are still in the Test Script #1 Fix Script.
1. Navigate to System Definition > Fix Scripts.
2. Select New.
3. Enter the Name Test Script #2 (or a name of your choosing)..
4. Make the script field full screen.
5. Enter the script:
6. Position your cursor at the end of the comment, then select Ctrl+Enter (or equivalent).
Note: Now Assist assumed case was the sn_customerservice_case table. As of October
2023, Code Assist does not validate that specific table or fields exist, so always verify
the table and field names.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
16
7. Select Esc while in the script field to dismiss the recommendation.
8. Update the script to:
9. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
Note: by adding HR, Now Assist was able to pick the HR Case table instead of the
CSM Case table.
10. Select Esc while in the script field to dismiss the recommendation.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
17
12. Position your cursor at the end of the comment, and select Ctrl+Enter (or equivalent).
Note: Now Assist was able to understand that x_a123_cases was a table name and
uses it as such. Although it is not validating the table name or field names, it will use
common names for the attributes. Again, always validate table and field names in the
generated code.
13. Select Esc while in the script field to dismiss the recommendation.
15. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
18
Note: the event may or may not exist. Now Assist is predicting the name based on
what you asked it to do.
Scenario: we need to find all the incidents that have an assigned to user that is no longer with our
organization, move the assignment to their manager, and then notify each manager only once that
some records have been assigned to them.
1. Use the same Fix Script, delete the current code, and add the following:
2. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
Note: you may need to update the generated code to reflect the code shown here.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
19
4. Inside the while loop add the following:
// for all the records assign the incident to the assigned to manager
5. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
var managerList = [ ];
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
20
8. Now we want to store the managers into that array, so add the following comment inside
the while loop:
9. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
21
11. Almost there! Add the last comment *outside* the function:
12. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
Note: As previously covered, the event it used might not exist and needs to be adjusted to one
that exists or create one with that name and link it to the proper notification record. Now you’ve
seen how to combine the code suggestions together to craft a more complex scenario.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
22
Exercise 3: Code Assist - Advanced
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
23
4. Select the plus sign to add a new step.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
24
6. Replace the default … code … with this comment:
7. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
Note: Code Assist knows the ServiceNow APIs, in this case GlideSystem represented by
gs. and how to appropriately use them. Code Assist completed the comment in
addition to adding the code. This happens when the comment is a little vague, but it
still understands what you are asking.
The outputs.session_timeout variable may or may exist so validate that before saving. As
of October 2023, Code Assist does not take into account the input or output variables
that have already been defined.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
25
10. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
Note: the comment was again appended with more detail and that Code Assist knew how to correctly
use the PAScorecard API1.
As of October 2023, Code Assist is not scope aware so while this action would work in the global
scope, if it was in a scoped app, it would need to have global. prepended to the
SNC.PAScorecard call.
Attachments
1. Click outside the script field to dismiss the suggestion. Replace the comment with:
// get the list of attachments for inputs.record and check if the file name ends in JS
1 https://docs.servicenow.com/csh?version=latest&topicname=PAScorecard
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
26
2. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
Note: Code Assist knows to use the GlideSysAttachment API to get attachments. With that it
understands how to use the results. Understanding the context, it is able to set the outputs for
the action.
3. Click outside the script field to dismiss the suggestion.
4. Replace the comment with:
// get the list of attachments for inputs.record and check if the file name ends in JSON and
return output.isJson
5. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
Note: a small change in the comment with more specifics on what you are looking for provides
code better suited for your purpose.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
27
Make a Decision (or call a Flow)
1. Click outside the script field to dismiss the suggestion.
2. Replace the comment with:
3. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
Note: Now Assist makes a call to the Decision Table API with a default decision ID.
You need to replace this with the sys_id of the decision you want to call.
4. Click outside the script block to dismiss the suggestion.
5. Replace the comment with:
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
28
6. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
Note: provide the sys_id in the comment so that it can be used in the code.
Note: the generated code does not appear to be complete. We can use code
completion to get the rest of it.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
29
8. Move the cursor to the end of generated code.
Again the code is not complete. In this example, the generated code is adding every
option from the API to the outputs so the full code is quite verbose.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
30
10. Position the cursor at the end of the generated code and select Ctrl+Enter (or equivalent)
until the code appears complete.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
31
2. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
Note: Now Assist knew to output the message to an outputs variable. Also, note that in this
context, Now Assist completed the comment to send a notification and did that in the code.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
32
8. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
In this example, there are no special variables, so the code just puts the results into an array
to be used later.
9. Navigate to Instance Scan > Checks.
10. Select New.
11. Select Create a new Script Only Check.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
33
13. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
Note: Now Assist knows about the engine variable and how to use it.
14. Navigate to System Notifications > Email > Notification Email Scripts.
15. Select New.
17. Position your cursor at the end of the comment and select Ctrl+Enter (or equivalent).
Note: the email scripts know to use the template object and not a gs.info or engine.finding call.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
34
Exercise 4: Flow Assist – Flow Recommendations
Flow recommendations provides a set of recommendations on the next best action when you are
authoring a flow.
Note: You need to have the now.assist.creator role assigned to you to perform this exercise. If you
performed the previous exercises, then you already have the role. If you’re starting with Flow Assist,
refer to Exercise 2.1 steps 6-10 (pages 10-11) to assign the role to yourself before proceeding.
4. Select Submit.
5. Select Add a trigger.
6. Select Scheduled > Daily.
7. Select Done.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
35
8. Verify the first set of recommendations appears for the first action.
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
36
14. Drag the User Records pill (1) from the Data panel to the Items field (2).
As you add more actions to your flow, the recommendations continue to adapt to predict your next
action based on the trigger and all of the previous actions. The same action may not always have
the same recommendations actions since what came before it may differ.
If the action you want is not in the list, you may always pick the action using the standard
methods in Flow Designer.
Additional Resources
Model data cards for text-to-code and flow next-best-action are available for further reference.
Lab Completion
Congratulations! You have completed the Now Assist for Creator enablement bootcamp
session exercises and earned .003 college credits from SMU (Sock Monkey University).
© 2023 ServiceNow, Inc. All rights reserved. ServiceNow, the ServiceNow logo, Now, Now Platform, and other ServiceNow marks are trademarks and/or registered
trademarks of ServiceNow, Inc. in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with
which they are associated.
37