_
_
Back to Blog
ServiceNow
No items found.

Now Assist Series: Accelerating Development with Code Generation

Unlock Increased Productivity and Precision with AI-Driven Code Suggestions
5
min read
|
by
Ryan McStravick
December 5, 2024

Introduction

In the ever-evolving world of development, efficiency and precision are key. ServiceNow’s Now Assist for Code Generation is a game-changing feature that empowers developers by combining artificial intelligence with intuitive coding workflows. Whether you're streamlining repetitive tasks or brainstorming solutions to complex problems, this tool provides developers with intelligent code suggestions tailored to their needs.

What is Now Assist for Code Generation?

Now Assist for Code Generation is an AI-powered feature in ServiceNow that simplifies the coding process. By describing the desired outcome in natural language, developers can receive tailored JavaScript code suggestions directly within the ServiceNow platform’s script editor or Workflow Studio. These suggestions are not just placeholders—they are fully functional, context-aware snippets designed to integrate seamlessly into your scripts.

Why Should You Use Now Assist for Code Generation?

  • Boost Productivity: Writing boilerplate code or researching syntax can slow down project timelines. With Now Assist, these tasks are significantly streamlined, allowing developers to focus on higher-value activities like system design and testing.
  • Enhanced Accuracy: AI-generated code minimizes the risk of errors, ensuring adherence to coding standards and best practices. Developers can trust the suggestions to meet functional and efficiency requirements.
  • Contextual Insights: The AI generates context-specific code that aligns with the developer’s intent by analyzing the provided prompt, reducing the need for extensive modifications.
  • Version Control and Tracking: Accepted AI-generated code is marked with a line indicator in the script editor, providing transparency and traceability for team reviews. The tracking can be configured and remains visible by default for six months, supporting collaborative efforts in debugging or audits.

How Does It Work?

In the Code with Now Assist dialog box, developers describe the desired code in natural language. The AI processes the prompt and suggests code aligned with the input.

  • Open the script editor and invoke Now Assist by right-clicking and selecting Open Code with Now Assist or using one of the following keyboard shortcuts: Cmd+Enter (Mac) or Ctrl+Enter (Windows).
  • Provide a description of the code to generate (less than 1,000 characters).
  • Review the suggestion and either accept, modify, or reject it.

Now Assist for Code Generation provides developers with three versatile methods to create scripts, making them adaptable to different coding needs:

  • Generate from Text: Describe the desired functionality in natural language. The AI processes your input and suggests a script that aligns with your description. Simply type your goal into the Code with Now Assist dialog box and review the generated script.
  • Generate from Code: If you’ve started a script, let Now Assist complete it for you. Enter partial code, such as a function header, and invoke the AI to generate the next steps based on the context.
  • Generate from Text and Code: Combine text-based descriptions with partial code to guide the AI in producing precise suggestions. Use comments to describe your goals or provide a snippet to shape the generated output.
Code with Now Assist dialog box with the text "Validate emails using regex" and a code suggestion in the script editor.

Once a suggestion is generated, you can:

  • Accept the code to include it in your script.
  • Reject it to remove it.
  • Modify your input to refine future suggestions.

By offering flexibility in how you start, Now Assist adapts to your workflow and simplifies coding tasks, whether you’re brainstorming from scratch or enhancing existing scripts.

Pro Tip: Keep a log of successful prompts to accelerate future workflows and maintain consistency.

Best Practices for Using Now Assist

  • Craft Effective Prompts: Provide clear and concise descriptions, specifying details such as APIs, task requirements, or constraints. Example: "Write a business rule to populate the 'Manager' field based on the 'Department' field value."
  • Iterate for Refinement: Experiment with different levels of detail to optimize suggestions. Adjusting the language or providing a starting snippet can significantly improve outcomes.
  • Conduct Rigorous Reviews: AI-generated code should be tested thoroughly to ensure functionality and adherence to organizational standards.
  • Control AI Tracking: Utilize the built-in tracking to distinguish between AI-generated and manually written code. This is invaluable for collaborative development environments.
Line that indicates which lines of code are AI-generated.

ServiceNow’s Now Assist for Code Generation redefines how developers approach coding challenges. By blending AI with intuitive workflows, this feature reduces the time spent on repetitive tasks, enhances accuracy, and encourages creativity in problem-solving. Whether drafting a quick script or building complex workflows, Now Assist can help elevate your development game.

Integrating this powerful tool into your daily operations not only accelerates development but also fosters a culture of innovation and precision.

Ready to transform your ServiceNow experience? Start experimenting with Now Assist for Code Generation today or reach out to our team at chat@rapdev.io for support!

Written by
Ryan McStravick
Born and raised in West Chester, PA, Ryan McStravick brings 15 years of diverse IT experience to the table. A lifelong Philadelphia sports fan, gamer, and tech enthusiast, Ryan is passionate about helping others and constantly exploring new technologies to stay ahead in the ever-evolving tech landscape.
More by
Ryan
No items found.
you might also like
back to blog