---
sourceDocument: Yokohama Build or modify applications
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/yokohama/application-development

 Release :

    - yokohama

ft:locale :

    - en-US

ft:publication_title :

    - Yokohama Build or modify applications

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Development, Data, and Analytics


---

# Exploring code generation

# Exploring code generation {#ariaid-title1}

* Release version: Yokohama
* 
* Updated January 30, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 minutes to read

Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of Exploring code generation

ServiceNow Otto for Code leverages AI-generated code capabilities to assist developers scripting on the ServiceNow AI Platform.
Available as part of the Creator Pro Plus offering, it supports the Now LLM Service and Azure OpenAI model providers, enabling code generation, code editing, code explanation and summarization, and code autocomplete functionalities.
This empowers developers with different scripting experience levels to efficiently create and refine custom scripts.
Show full answer Show less  

## Key Features

* **Code Generation:** Developers describe the desired code functionality in the Code with Now Assist dialog box within the JavaScript editor or Workflow Studio script steps. The AI provides code suggestions which can be reviewed and accepted or rejected before insertion into the script. The now.assist.creator role is required to use this feature.
* **Code Autocomplete:** While typing in the script editor, developers receive contextually relevant AI-generated code suggestions after a brief delay. Accepting suggestions is done by pressing tab, and rejecting with the escape key. Accepted suggestions can be saved by selecting Update.
* **Code Explain and Summarize:** Available only when using the Azure OpenAI model, this feature offers summaries and detailed explanations of code functions, helping developers understand script behavior.
* **AI-Generated Code Tracking:** AI-generated lines are visually indicated next to line numbers until edited by the developer, helping track which parts of the script originated from AI suggestions.
* **Switchable Model Providers:** Users can choose between Now LLM Services and Azure OpenAI to generate and interact with code.

## How It Benefits You

* **Improves Script Quality:** By generating and explaining code, it reduces errors and enhances script robustness.
* **Accelerates Development:** Automates repetitive coding tasks and speeds up script creation through natural language prompts and autocomplete suggestions.
* **Supports Developers of All Skill Levels:** Helps beginners start coding and allows experienced developers to iterate more efficiently.
* **Enhances Code Understanding:** Code explanation and summarization aid in knowledge transfer and troubleshooting.

## Usage Considerations

To utilize code generation features, developers must have the appropriate role assigned (now.assist.creator). The AI-generated suggestions are optional and require acceptance before being added to scripts, ensuring full developer control. The explanation and summarization features require use of the Azure OpenAI model provider.  
Learn about how AI-generated code can empower developers scripting on the ServiceNow AI Platform.
ServiceNow Otto for Code supports both the Now LLM Service and Azure OpenAI model providers.  
This capability is a part of Creator Pro Plus offering and includes the following skills:

* Code generation
* Code editing
* Code explain and summarize
* Code autocomplete
{#exploring-now-assist-code__ul_dst_1mv_1fc}

You can switch between Now LLM Services and Azure OpenAI. For more information, see [Exploring code generation](https://www.servicenow.com/docs/access?context=exploring-now-assist-code&version=yokohama&pubname=yokohama-api-reference&ft:locale=en-US)

## Code generation overview {#exploring-now-assist-code__section_jn1_ysb_vyb}

ServiceNow Otto for Creator activates the code generation skill. With code generation, you provide text describing the code to generate and get code suggestions in the JavaScript editor on forms in the ServiceNow AI Platform and in Script steps in Workflow Studio. Developers with varying levels of experience in scripting on the ServiceNow AI Platform can benefit from using code generation to get started writing custom scripts or iterate on scripts more efficiently.

To generate code suggestions, you describe the goal of the code to generate in the Code with Now Assist dialog box. The code suggestion appears in the lines following your prompt but isn't added to your script until it's accepted.

Note:  
Developers must be assigned the now.assist.creator role to use code generation. For more information about using code generation, see [Generate scripts with AI-powered code generation](https://www.servicenow.com/docs/access?context=generate-code&version=yokohama&pubname=yokohama-api-reference&ft:locale=en-US).

## Code generation workflow {#exploring-now-assist-code__section_vpm_43p_vyb}

1. From the script editor, a developer opens the Code with Now Assist dialog box and describes the code that they want to generate.
2. The developer triggers generating a code suggestion. In the following example, a developer describes what they want the script to do in the Code with Now Assist dialog box. The code suggestion appears highlighted in the script editor.

3. The developer reviews the AI-generated code suggestion and either accepts or rejects it.
   * If the developer accepts it, the code is added to the script. The developer can make any necessary edits based on further review.
   * If the developer rejects it, the code isn't added to the script. The developer can rephrase the prompt to generate a new code suggestion.

   {#exploring-now-assist-code__ul_p2h_v3q_vyb}  
   In the following example, a line next to the line numbers indicates which code was created by AI and hasn't been edited. If you edit AI-generated code, the line indicator doesn't appear for those lines of code. Figure 1. AI-generated code lines

{#exploring-now-assist-code__ol_bhv_rhq_vyb}

Optionally, you can turn on code completion functionality to use code or single-shot prompts in script editors with Now Assist for code generation.

## Code autocomplete overview {#exploring-now-assist-code__section_slq_xgf_h2c}

The autocomplete feature of ServiceNow Otto for Code provides you with contextually relevant code suggestions while typing.  
Note:  
It takes a few seconds for the code suggestions to appear.

## Code autocomplete workflow {#exploring-now-assist-code__section_srf_33f_h2c}

1. A developer begins coding in the script editor.Within a few seconds, contextually relevant code suggestions are displayed in grey.

2. The developer reviews the AI-generated code suggestions and either accepts or rejects them:
   * The developer must press the tab key to accept the suggestions.

     If the developer accepts, the code is added to the script.
   * The developer must press the esc key to reject the suggestions.

     If the developer rejects, the code isn't added. The developer can continue to code and wait for a few seconds for the suggestions to
     appear.
   {#exploring-now-assist-code__ul_s31_3jf_h2c}
3. After accepting the code suggestions, the developer selects Update to save the script.

## Code explain and summarize overview {#exploring-now-assist-code__section_tls_vhf_h2c}

The code explain and summarize features are only available with the Azure OpenAI model provider.

The code explain and summarize features provide a summary of the code and a comprehensive explanation of its functionality.

## Code generation benefits {#exploring-now-assist-code__section_ypm_43p_vyb}

{#exploring-now-assist-code__table_e12_qqv_jyb__entry__3}

| Benefit | Feature | Users |
|-|-|-|
| Improve quality of scripts, automate repetitive coding tasks, and reduce time spent searching for or recalling code | [Text-to-code and code complete](https://www.servicenow.com/docs/access?context=generate-code&version=yokohama&pubname=yokohama-api-reference&ft:locale=en-US) | Developers |
| Identify code generated by AI | [Tracking AI-generated code](https://www.servicenow.com/docs/access?context=tracking-ai-generated-code&version=yokohama&pubname=yokohama-api-reference&ft:locale=en-US) | Developers, administrators |
[ ]

{#exploring-now-assist-code__table_e12_qqv_jyb}

