NOWCommunity Live Stream - Code Decoded - Using a Constants script include

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • In this video I'll show you how to make your server side JavaScript easier to maintain. We've talked about Script Includes as a way to improve unit testing, abstracting and reusing logic, but there's another use for them to help remove hard-coded values, decrease maintenance, and improve readability to the rest of your code.
    Join us Mondays and Thursdays at 2PM UTC.
    Episode topics include:
    * Script Includes
    Code snippets shown in this video are available at: github.com/chu...
    References:
    * Knowledge 2020 - knowledge.serv...
    * Learn JavaScript on the Now Platform - bit.ly/sn-learn-js
    * ServiceNow Developer Site - developer.serv...
    * ServiceNow Developer meetups - meetup.com/pro...
    * Book: No-Code Apps For Dummies - bit.ly/sn-ncafd
    * TechNow Episode 6: Script Includes - community.serv...
    * Docs: Script Includes - docs.serviceno...
    Join the discussion on the community: community.serv...

Комментарии • 14

  • @rahulyamgar5205
    @rahulyamgar5205 4 года назад +3

    Just for everyone who reads this comment: Often you would see the gs.include() mentioned in the code, Per Chuck its not needed and can be disregarded and need not use.

  • @irstonantao2375
    @irstonantao2375 4 года назад +1

    Awesome session as always:)

    • @ChuckTomasi
      @ChuckTomasi 4 года назад

      Thank you.

    • @ayeshanouma2814
      @ayeshanouma2814 4 года назад

      @@ChuckTomasi want to know how we can call script include through catalog client script in custom scope

  • @rahulyamgar5205
    @rahulyamgar5205 4 года назад +1

    Hello Chuck, Thanks again for very nice session ! I have few system properties defined and called in various SIs or scripted REST APIs...Accessing property values using Constants provides any performance benefits over repetitive gs.getProperty("P_NAME") ?

    • @ChuckTomasi
      @ChuckTomasi 4 года назад +1

      It's not any faster because properties are cached anyway. The main thing is if you need to change the property name (or default value - the second parameter), you only need to do it in one place.

  • @gaspar8888
    @gaspar8888 2 года назад

    Thanks for your job! Im searching for how I DO a Calculated COLUM in SERVICE NOW; i.e.
    W = X + Y ...

  • @ayeshanouma2814
    @ayeshanouma2814 4 года назад

    Want tutorial on script include through catalog client script in custom scope

    • @ChuckTomasi
      @ChuckTomasi 4 года назад

      Hi Ayesha, you can call a script include from a client script (standard or catalog, scoped or global) using GlideAjax. Take a look at episode 33 of TechNow here: bit.ly/servicenow-technow

  • @reddpill
    @reddpill 4 года назад

    Have you seen the code in SN? Clearly most of the devs have lost their founders ethos!

    • @ChuckTomasi
      @ChuckTomasi 4 года назад

      Please email me some examples. I can share them with the product teams. I know that the concepts in this video are used in some places as it was originally pointed out to me by a colleague from some baseline scripts.

    • @reddpill
      @reddpill 4 года назад

      Chuck Tomasi have a browse through the scripted web services or any widget.

    • @ChuckTomasi
      @ChuckTomasi 4 года назад

      @@reddpill Given that there are a LOT of these records, can you point me at some specific examples?

    • @reddpill
      @reddpill 4 года назад

      @@ChuckTomasi ​ @Chuck Tomasi Here's one I saw yesterday, and look into the associated script records for that end point. You might need to install the Event Module.
      Scripted REST Resource > Inbound Event > Inbound Event Post
      Also, not only widgets have a look through some of the business rules. The problem exists throughout the platform.