Build form and business logic

  • Release version: Washingtondc
  • Updated February 1, 2024
  • 2 minutes to read
  • Summarize
    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 Build form and business logic

    Building an application in ServiceNow requires implementing both form logic and business logic, which dictate the visibility and functionality of forms as well as data handling rules. It is essential to carefully consider the use of scripting versus low-code solutions to maintain upgrade compatibility and leverage platform capabilities.

    Show full answer Show less

    Key Features

    • Logic Assessment: Evaluate whether the logic is essential to the application and explore no-code solutions such as Flow Designer, Virtual Agent, and UI Policies first.
    • Scripting Scenarios: Use scripting for specific tasks like creating Flow Designer actions, Scripted REST APIs, and customizing Service Portal widgets.
    • Modifying Behavior: Directly edit artifacts instead of copying and deactivating them to maintain version history and visibility of customizations.
    • Form Logic: Apply visibility controls to enhance user experience by showing only relevant fields on forms.
    • Business Rules: Implement server-side actions during CRUD operations to automate record handling.
    • Flow Designer: Utilize this feature for process automation using natural language, eliminating the need for extensive coding.

    Key Outcomes

    By effectively utilizing form and business logic, ServiceNow customers can streamline application design, enhance user productivity, and ensure ease of maintenance during upgrades. Embracing low-code solutions can lead to quicker implementations and a more agile response to changing business needs.

    The next step in designing an application is to build logic. Logic includes form logic (what people can and cannot see/use on a form) and business logic (rules that govern what happens to data when it is entered).

    Scripting and modifications

    Before writing any code, be aware of the impact on upgrades and the adoption of new ServiceNow features. Particular care should be taken when modifying baseline artifacts and processes.

    Consider the following before scripting:

    • Assess the requirement. Is the logic critical to the functioning of the app?
    • Determine if ServiceNow can be configured to fulfill the requirement without code.
    • Leverage options, such as Flow Designer, Virtual Agent, and UI Policies to take advantage of platform capabilities without writing code.
    • Low and no-code approaches to logic are easier to debug and upgrade.

    Examples of when scripting is appropriate:

    • Building Flow Designer actions
    • Creating a Scripted REST API
    • Creating logic for scoped applications in Script Includes
    • Customizing and creating widgets for Service Portal

    Evaluate the business requirement and consider a no-code route before using a scripted solution.

    Be aware of ServiceNow enhancements. For example, in the orlando release, Virtual Agent conversations have more no-code options than London. Read release notes and other publications. Get certified and stay current with your certifications.

    To better understand when to customize, review the Innovate at Scale Success Playbook on the Customer Success Center.

    Modifying default behavior

    In the past, one of the strategies used was to copy the artifact to update and to deactivate the original. The copy/deactivate approach is no longer recommended due to the following issues:

    • Developers cannot tell if a deactivated artifact was upgraded without research.
    • Two files, the original and the copy, need to be maintained. Maintenance doubles each time a customization is made.
    • With each release, the customized record becomes older.
      • Customers do not receive the enhancements included in a new release.
      • A new release may rely on the original record being updated.
      • Developers may make more changes to compensate for the original record being inactive.

    A script where only the Active flag is changed will be updated, but the script does not appear on the skipped list. With the copy and deactivate strategy, a developer has less visibility into customizations and cannot easily assess or revert to the baseline version.

    Rather than copying and deactivating the original artifact, edit the artifact directly. The ServiceNow Upgrade Engine will add the latest version to the version history and report that the artifact was skipped. Developers can see a new version is available with the upgrade.