├── .gitignore ├── .vscode ├── launch.json └── tasks.json ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── autocomplete ├── GlideQuery.js.txt ├── additional.client.d.ts.txt ├── additional.server.d.ts.txt ├── client.d.ts.txt ├── info.md ├── jelly.json ├── jsconfig.json.txt └── server.d.ts.txt ├── data.json ├── img ├── enablesnu.png ├── eslint.png ├── helpertab.png ├── icon128.png ├── icon24.svg ├── icon256.png ├── saveform.png ├── sn-scriptsync-css.gif ├── sn-scriptsync.gif ├── startstop.png └── treeview.gif ├── jsconfig.json ├── package-lock.json ├── package.json ├── resources ├── convertTernToDTS.js ├── images │ ├── html.svg │ ├── js.svg │ ├── json.svg │ ├── less.svg │ ├── scss.svg │ ├── ts.svg │ ├── txt.svg │ └── xml.svg ├── metaDataRelations.js └── metaDataRelations.json ├── src ├── ExtensionUtils.ts ├── InfoTreeViewProvider.ts ├── ScopeTreeViewProvider.ts ├── constants.ts └── extension.ts └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package-lock.json 3 | build 4 | out 5 | npm-debug.log 6 | .env 7 | .DS_Store 8 | *.vsix 9 | roadmap 10 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [{ 8 | "name": "Run Extension", 9 | "type": "extensionHost", 10 | "request": "launch", 11 | "runtimeExecutable": "${execPath}", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ], 15 | "outFiles": [ 16 | "${workspaceFolder}/out/**/*.js" 17 | ], 18 | "preLaunchTask": "npm: watch" 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // See https://go.microsoft.com/fwlink/?LinkId=733558 2 | // for the documentation about the tasks.json format 3 | { 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "npm", 8 | "script": "watch", 9 | "problemMatcher": "$tsc-watch", 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never" 13 | }, 14 | "group": { 15 | "kind": "build", 16 | "isDefault": true 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG.md 2 | 3 | 4 | ## 3.3.8 (2025-09-02) 5 | Fixes / changes: 6 | - Update dependencies 7 | - Preparation for createArtifact command 8 | 9 | ## 3.3.6 (2025-02-08) 10 | Fixes / changes: 11 | - Prevent scriptsync trigger when document is autosaved (Issue #105) 12 | 13 | ## 3.3.5 (2024-10-05) 14 | Fixes / changes: 15 | - Fix for loading scope artefacts (Issue #101) 16 | 17 | ## 3.3.4 (2024-04-18) 18 | Fixes / changes: 19 | - Improve error handling with SN Utils helper tab 20 | - Added CONTRIBUTING.md 21 | 22 | ## 3.3.3 (2024-04-18) 23 | Fixes / changes: 24 | - Misspelling fix (PR #95) 25 | 26 | ## 3.3.2 (2024-04-15) 27 | Fixes / changes: 28 | - Support for Inline PowerShell script from Flow Designer Actions (Discussion #492) 29 | 30 | ## 3.3.1 (2024-03-25) 31 | Fixes / changes: 32 | - Improvements to the BG script execution. 33 | 34 | ## 3.3.0 (2024-03-23) 35 | Features: 36 | - Improved BG Script execution, you can now select to run it in current or global scope. 37 | 38 | ## 3.2.1 (2024-03-09) 39 | Features: 40 | - Execute Background Scripts in VS Code (SN Utils discussion #480, credit abhishekg999) 41 | 42 | ## 3.1.2 (2024-01-30) 43 | Fixes / changes: 44 | - Backgroundscript matching. (#issue 91) 45 | - Fix not being able to save _test_urls.txt for Widgets. 46 | 47 | ## 3.1.0 (2023-10-21) 48 | Fixes / changes: 49 | - Fix mixing up scope name and label in Link VS COde function in Studio 50 | 51 | ## 3.1.0 (2023-09-12) 52 | Fixes / changes: 53 | - Fix for Miiror in sn-scriptsync 54 | 55 | ## 3.0.9 (2023-08-23) 56 | Fixes / changes: 57 | - Allow filename change, that updates the _map.json file (Issue #85 PR #90 Blenderpics ) 58 | - Moved initializing of treeview to startServers method, so that it loads more consistent. 59 | 60 | ## 3.0.8 (2023-08-22) 61 | Fixes / changes: 62 | - Fix support for saving variables back to instance in the 3.x series 63 | 64 | ## 3.0.7 (2023-08-22) 65 | Fixes / changes: 66 | - Fix to allow non scoped files again (will be stored in folder no_scope) 67 | 68 | ## 3.0.4 (2023-08-15) 69 | Features: 70 | - Fixe to allow duplicate filename 71 | - Minor fixes for the 3.x update 72 | 73 | ## 3.0.0 (2023-08-15) 74 | Features: 75 | - Check https://youtu.be/cpyasfe93kQ for intro to version 3.0 76 | - New way of storing files in the structure instamce/scope/table/name.fieldtype.extension 77 | - Option to pull in all artefacts from current scope 78 | - Behind the scenes magic to determine all code fields in current instance as well as mapping files to map names to sys_id 79 | Fixes / changes: 80 | - Add /esc (Employee Center) to test_urls for widget development (Issue: #80) 81 | 82 | ## 2.7.3 (2023-06-15) 83 | Fixes / changes: 84 | - Explicit bind websocket to 127.0,0.1 (SN Utils Issue #405) 85 | 86 | ## 2.7.2 (2023-04-08) 87 | Fixes / changes: 88 | - Upgrade Node dependencies 89 | - Remove mkdirp package use in favor of fs.mdir recursive option 90 | - Remove /dist directory 91 | - Activated CodeQL repository scanning and applied fixes 92 | 93 | ## 2.7.0 (2023-04-07) 94 | Features: 95 | - Save files when instances has a diffrent scope selected, requires SN Utils >= 6.4.0.0 96 | 97 | ## 2.6.1 and 2.6.2 (2023-02-13) 98 | Fixes / changes: 99 | - bugfix new intellisense function 100 | 101 | ## 2.6.0 (2023-02-13) 102 | Features: 103 | - generate types with tablenames and properties to support intellisense for those (Issue #77) 104 | - added CHANGELOG.md to maintain a changelog 105 | - support to manual add content to the .ts file, in additoion to auto generated ones 106 | - added info.md with instructions how to generate .md file (only for maintenance of sn-scriptsync) 107 | 108 | Fixes / changes: 109 | - updated d.ts files 110 | - added TemplatePrinter intellisense based on PR #75 111 | 112 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Same policy applies as SN Utils. 2 | See that repo for more details. PR must always be pre aligned and approved. -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | SN Utils and sn-scriptsync comes without warranty. 2 | IP of Arnoud Kooi. 3 | Not allowed to re-publish or other platforms or marketplaces without permission of Arnoud Kooi -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VS Code ScriptSync for ServiceNow 2 | Easy Integration from ServiceNow to VS Code to be able to script in a full fledged editor, without any configuration. 3 | 4 | # Important 3.0 update 5 | In August 2023 the 3.0 update is released. 6 | This update requieres a resync of your file. 7 | It is recommended to delete all artefacts save via the 2.x version 8 | 9 | Reason is that this vesion changes the way the files are stored. 10 | Files are now stored in the stucture: 11 | 12 | `instancename\scopename\tablename\recordname.field.extension` 13 | 14 | Tables like sp_widget are stored as: 15 | 16 | `instancename\scopename\tablename\recordname\field.extension` 17 | 18 | In the scriptsync view, available in the left pane you can now pull in all artefacts fron the current scope! 19 | This also can show your artefacts in a virtuak way, with "Related List" 20 | Please let me know if you exoerience issues, preferable via a GitHub Issue. 21 | 22 | 23 | ![Use Extension](img/sn-scriptsync.gif) 24 | 25 | ## [YouTube quick 3.0 demo (August 2023)](https://www.youtube.com/watch?v=cpyasfe93kQ) 26 | 27 | # SN Utils 28 | Requires the latest version of SN Utils, links via: 29 | [arnoudkooi.com](https://arnoudkooi.com) 30 | 31 | **In case of issues, always check for the latest version of both the browser and VS Code extension, and update if needed!** 32 | 33 | # Setup 34 | After installing both this extension and the browser extension, open a folder in VS Code and enable scriptsync in VS Code. 35 | 36 | ## Setting folder 37 | In the settings page you can enter a default file path. 38 | When this folder is opened as workspace, the service is automatically started. 39 | Default value for path: ~/Documents/sn-scriptsync 40 | 41 | 42 | ## Manual start/stop 43 | The ScriptSync service can be manually started or stopped by clicking the Statusbar text in the bottom of the window. 44 | ![Use Extension](img/startstop.png) 45 | 46 | ## Enable in SN Utils 47 | From the browser ScriptSync must be enabled once, by opening the popup and in the settings tab enable the checkbox 48 | ![Use Extension](img/enablesnu.png) 49 | 50 | # Usage 51 | While using, be sure to keep the helper tab open. This will show logging and acts as a communication channel between ServiceNow and VS Code. This will be automaticly opened when clicking a scriptsync button in your instance. 52 | ![Helper tab](img/helpertab.png) 53 | 54 | ## Forms 55 | After activating, in forms for appropriate fields, such as script, css and html a small save button will display. 56 | 57 | Clicking it will save the current field value direct to the filesystem and open it in VS Code. 58 | ![Save from form](img/saveform.png) 59 | 60 | In VS Code the structure for the file will be: 61 | instance/table/fieldname^scriptname^sys_id.extension 62 | 63 | Saving it in VS Code, will save it back to the instance. 64 | 65 | ## Widgets 66 | The workflow for ServicePortal widgets is shown in the animated gif above. From the widget editor click on the save button. 67 | This will create all the relevant fields as files on the filesystem, in a folder with the name of the widget. 68 | In a subfolder the angular ng-templates will be placed. 69 | 70 | Besides that a file test_urls.txt is created. 71 | In this page you can add your own urls. When saving a file, ScriptSync will refresh the browser pages that match that URL, enabling live preview. 72 | 73 | Widget SCSS can be live edited, each change can immediate be previewed in the browser. See animation below. 74 | 75 | ![Use Extension](img/sn-scriptsync-css.gif) 76 | 77 | ## Studio integration 78 | In studio you can click Link VS Code via sn-scriptsync. 79 | It will show you the tree of artefacts in your app and all the scriptable fields. 80 | When clicking an field, it will be pulled from the server. If the file is already open, it will switch to that window. 81 | This is an alterbative to clicking each individual button in the platform. SP widgets are not jet supported at this point. 82 | Note this feature is in beta. 83 | ![Helper tab](img/treeview.gif) 84 | 85 | 86 | ## Intellisense 87 | Basic inteliisense is added to autocomplete the ServiceNow API's and functions. 88 | 89 | ## ESLint 90 | I recommend installing ESLint and the [ESLint ServiceNow plugin](https://www.npmjs.com/package/eslint-plugin-servicenow). 91 | This will do some basic code checks. 92 | 93 | ![ESLint](img/eslint.png) 94 | 95 | ## FAQs 96 | 97 | I'm using `