Welcome to the Pre-Release Build
Pre-release build of S.N.I.C.H.
WARNING: This version may be unstable.
This is too long and you're not gonna read it? No problem. We've got some "under 2 minute" instructional and tip videos you can find on youtube!
Tip: Everything is done through the command pallete (Ctrl+Shift+P, or CMD+Shift+P on macs). Once launching the command pallete type in SNICH to see a list of all the available commands.
Now when Configuring additional tables, you the system will ask you to add Name fields, grouping fields, and display fields. It will then ask if you want to add "additional fields" instead of the multi-select. This allows you the benefit of being able to "order" the fields based on the order you pick them in. Previously the multi-select style would not allow this.
Updated the pre-configured tables to now group files into sub-folders.
Groupings added to default tables
The follow default tables have had "Grouping" functionality added to them. Note if you have configured custom tables, you will need to re-configure them.
- Business Rules [sys_script]
- Collection\When\Order\Name (ex. \incident\after\100\Task State Manager)
- Angular Providers [sp_angular_provider]
- Type\Name *(ex. \Directive\addUibTabAccessibility)
- UI Action [sys_ui_action]
- Table\Name *(ex. \incident\Create Change Request)
- Client Script [sys_script_client]
- Table\Name *(ex. \incident\Work Notes Required)
- Scripted REST Resource [sys_ws_operation]
- Scripted Rest Service\Method\Name *(ex. \FollowNotifications\POST\action)
- Record Producer [sc_cat-item_producer]
- Table\Name *(ex. Incident\Report Incident)
Add your own groupings / sub-folders!
Add your own or change the default groupings by using the command pallete command: Configure Table (New and Update)
Now when configuring a new instance, we will reach out to the sys_user_preference table and look for a preference for you and your table config unique to that instance.
Benefits
- When configuring a new table, will sync your entire table config to a user preference: vscode.extension.snich.table_config
- Then, when you need to wipe out your Instance folder and start over (For any reason) you won't lose you configured tables!
- In short...
- "Setup new instance" - Checks for existing user preference and pulls config if available. If not available, creates the standard table config and syncs to your instance/preference
- Then when configuring new tables, we ensure to keep that sys_user_preference in sync!
You can now open the Active file in ServiceNow! Will Launch your default web browser directly to the record. Passing along the application scope so you don't get that pesky prompt about switching scopes!
Originally, the OAuth mechanism didn't work consistently and even more so I still had to store your username AND snich "saw" your password A security hole I honestly want nothing to do with, but understand it's a necessity in some cases (like background scripts currently).
For regular SNICH usage (everything but background scripts) the Authorization Code OAuth flow is now supported!
Quick Steps
- Setup a new instance (Sorry if you want to convert an old one, no options right now..)
- Select the "OAuth (Preferred)" Option
- It will prompt you to choose:
- Create a New OAUTH Application registry in ServiceNow. This will launch your web browser with a pre-filled record. All you need to do is "Save" that record, and copy the client ID and Client Secret over to SNICH when prompted.
- Open Your OAUTH applicaation Registry in ServiceNow. This is so that if you've already created one, you can re-use it! Note the redirect URI is https://localhost:62000
- "Im Good". You've already got your Client ID and Client Secret handy. Look at you, you OAuth wizard!
- After determining how you want to get your Client ID and Client Secret, you will be prompted to enter them.
- After entering your Client Secret the system will launch your web browser to perform the OAuth code request.
- In your browser, it will ask if you want to "Allow"... Click Allow
- This will redirect you to https://localhost:62000 IMPORTANT Some browsers may warn about the site being "unsafe", this is due to a self-signed cert. However, because we're hosting this "web site" from your local machine, this data never traverses the internet. Either way, we still encrypt it with SSL! :)
- At this point, you should get a message to close the browser window if everything went succesfully.
- After closing your browser window and coming back to SNICH you should see a "Test Connection Succesful Message". If you do not, open your command pallete and manually execute a "Test Connection" to validate successfull connection!
You can now run background scripts! woo! Some quick instructions (More to follow on insiders / main build);
Quick Steps
- Highlight any text, in any open editor, (Could be a new unsaved file, or an existing file)
- Optionally, you can choose not to highlight any text. If no text is highlighted we will run all text in active editor in the background script.
- Open the Command Pallete
- Search for "Run Background Script"
- Select the scope to run the background script in
- "Global" Run the script in global.
- "Scoped" Run the script in an application scope.
- If an unsaved file, it will prompt which scope to execute in.
- If file is saved, it will try to figure out the application scope based on the location of the saved file.
Couple of notes
- Currently this only works with Username/Password via Basic Auth. If you do not have a local password on your SN account and cannot set one up. I only have apologies and humbleness to not hate me for eternity.
- I am looking into providing this via OAuth mechanisms. Or optionally, launching you to the browser page with everything filled in as a last resort possibly..
- NOTE: While it does ask for your username/password when executing, it DOES NOT save them to disk and ONLY stores them in memory until you close VSCode.
- Right now the results will open a "Webview panel" and show the content exactly as it would appear in SN. It will also open the VSCode "Output Window" and show a HTML Stripped version there.
- There are plans to provide some settings to control this behavior. Right now mostly looking for feedback!
This extention provides code completion for ServiceNow Code API And Classes.
WARNING: This functionality is currently in a Experimental Stage. It's solid, but will be odd in a few places.
Call For Help: If you see oddities, please take a moment to submit a github issue on the GitHub Repo! Even if it's like a few words / sentences, or just a screenshot!
Example GlideRecord Code Completion
Example RESTMEssageV2 Completion and Return Object type from Method
Example Compare with Server
Primary Features
If you are into some heavy reading, this will go over the primary features!
Will kick off new instance configuration. Asking for the following information.
Note: Multiple Instances supported. Will create a unique instance folder inside your workspace folder.
- Instance name
- Authentication Type
- Basic (Warning: Will store ID and PW unencrypted. Be sure your computer is secure.)
Requires UserName and Password
- oAuth (Stores oAuth info unencrypted, but we DO NOT store your password at all in this scenario.);
- Authentication Information
- Depending on auth type selected, it will ask for the appropriate authentication information.
After setting up an intance. You will want to run this action allows to configure additional tables to sync records from.
When executing this command it will perform the following.
- Ask which instance you want to configure a table for.
- List all tables extended from "Application File (sys_metadata)" found on that instance.
- After selecting a table, it will retrieve all fields for that table and ask you to select which fields you want to sync.
- After selecting the various fields you want to sync, it will ask you to enter a file extension for each field being synced. Take note of the [field_type] to help guide you to which extension to use.
- Once done, you can use "Sync Record" to sync records from this table.
Once an instance has been configured, you can execute the test connection command to verify connectivity. This will be automatically executed during the New Instance setup process.
Sync a record from a configured instance. Executing this command will perform the following.
- Asks which instance you wish to sync a record from the list of configured instances you setup.
- Asks which record type you want to sync from that instance. This is based on the tables configured for that instance.
- Asks which record from that table you want to sync.
- Will create a folder named the table_name within the instance folder.
- Create file(s) based on following criteria.
- If only one field from that table is configured for syncing, you will have a file in that folder named after the record to be synced.
- If multiple fields are configured for that table, a folder will be created that is the "Name of the sycned record" and then individual files will be created for each field for that record.
This command will sync all application files for each configured table for the selected application.
Note: There is a setting to adjust whether you can pull sn_ scoped applications or not.
Executing this command will perform the following:
- Ask which instance to load application files from.
- Ask which application on that instance to load.
- Starts syncing all files for that application for each configured table.
- Note: You may need to refresh your workspace explorer for all the folders/files to show up.
This command will compare the active text editor with the associated server file. If the files are the same the compare window will not be loaded.
Executing this command will perform the following:
- Attempt to retrieve the server content for the file in the active text editor.
- Compare the text in the text editor (not on disk) with the server content.
- If content is different it will launch the vscode file compare window.
Requirements
Required Software
You must have access to a ServiceNow.com instance in order for this extension to work. If you're company does not have one or provide you access, you can sign up for a FREE personal developer instance.
Known Issues
Below are known issues and workarounds for them.
- Load All Application Files overwrites all files if i re-load an application.
-
Workaround: Save your files before reloading. Working on a more long term / permanent fix for this.
- Sometimes when loading new files the File Explorer is not refreshed and the file/folder may not be immediately visible.
- This seems to be better as of the latest version... keep an eye on it and let us know if it keeps happening.
-
Workaround: Expand/Collapse the instance folder or use the refresh button on the grey bar just above your instance name (the workspace folder header).