Skip to content

Instantly share code, notes, and snippets.

@emyrold
Last active September 30, 2019 12:51
Show Gist options
  • Select an option

  • Save emyrold/247e810c7ccee65166ea5202f868f785 to your computer and use it in GitHub Desktop.

Select an option

Save emyrold/247e810c7ccee65166ea5202f868f785 to your computer and use it in GitHub Desktop.
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-09-30T12:51:27.632Z","extensionVersion":"v3.4.3"}
[
{
"metadata": {
"id": "e337c67b-55c2-4fef-8949-eb260e7fb7fd",
"publisherId": "Shan.code-settings-sync",
"publisherDisplayName": "Shan"
},
"name": "code-settings-sync",
"publisher": "Shan",
"version": "3.4.3"
},
{
"metadata": {
"id": "74f34f8a-245e-4133-8617-a3a94b5a417e",
"publisherId": "cmstead.jsrefactor",
"publisherDisplayName": "cmstead"
},
"name": "jsrefactor",
"publisher": "cmstead",
"version": "2.20.4"
},
{
"metadata": {
"id": "5db78037-f674-459f-a236-db622c427c5b",
"publisherId": "PKief.material-icon-theme",
"publisherDisplayName": "PKief"
},
"name": "material-icon-theme",
"publisher": "PKief",
"version": "3.9.0"
},
{
"metadata": {
"id": "96fa4707-6983-4489-b7c5-d5ffdfdcce90",
"publisherId": "esbenp.prettier-vscode",
"publisherDisplayName": "esbenp"
},
"name": "prettier-vscode",
"publisher": "esbenp",
"version": "2.3.0"
},
{
"metadata": {
"id": "aae0701b-111f-49c1-9000-abd37a442f28",
"publisherId": "WallabyJs.quokka-vscode",
"publisherDisplayName": "WallabyJs"
},
"name": "quokka-vscode",
"publisher": "WallabyJs",
"version": "1.0.253"
},
{
"metadata": {
"id": "fb374ce1-5343-46c8-a425-900fdad15523",
"publisherId": "wesbos.theme-cobalt2",
"publisherDisplayName": "wesbos"
},
"name": "theme-cobalt2",
"publisher": "wesbos",
"version": "2.1.6"
},
{
"metadata": {
"id": "826d97bc-56ff-4fcd-88eb-1bf4092427fd",
"publisherId": "bubersson.theme-hop-light",
"publisherDisplayName": "bubersson"
},
"name": "theme-hop-light",
"publisher": "bubersson",
"version": "0.0.4"
},
{
"metadata": {
"id": "6766254a-8e43-4ebc-9b89-e5be39cb5318",
"publisherId": "WallabyJs.wallaby-vscode",
"publisherDisplayName": "WallabyJs"
},
"name": "wallaby-vscode",
"publisher": "WallabyJs",
"version": "1.0.144"
}
]
{
"terminal.integrated.shell.windows": "C:\\Users\\jcaruso\\AppData\\Local\\Programs\\Git\\bin\\bash.exe",
"diffEditor.ignoreTrimWhitespace": false,
"diffEditor.renderSideBySide": true,
"editor.formatOnSave": true,
"editor.minimap.enabled": false,
"editor.rulers": [
120
],
"editor.tabCompletion": "on",
"explorer.confirmDragAndDrop": false,
"extensions.ignoreRecommendations": false,
"files.autoSave": "off",
"git.autofetch": true,
"git.confirmSync": false,
"git.enableSmartCommit": true,
"http.proxySupport": "off",
"javascript.updateImportsOnFileMove.enabled": "always",
"prettier.printWidth": 120,
"prettier.singleQuote": true,
"prettier.tabWidth": 4,
"prettier.disableLanguages": [
"vue",
"markdown"
],
"window.newWindowDimensions": "maximized",
"window.zoomLevel": 0,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[typescript]": {},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"sync.gist": "247e810c7ccee65166ea5202f868f785",
"workbench.colorTheme": "Cobalt2",
"editor.fontSize": 16,
"workbench.iconTheme": "material-icon-theme",
"material-icon-theme.folders.theme": "classic",
"editor.fontLigatures": true,
"editor.fontFamily": "'Fira Code', Menlo, Monaco, 'Courier New', monospace"
}
{
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console - John": {
"prefix": "j_log",
"body": [
"console.log('$1');",
"$2"
],
"description": "John to console"
},
"For Loop - John": {
"prefix": "j_for",
"body": [
"for (var ${1:i} = 0; ${1:i} < ${2:len}; ${1:i}++) {",
"\t$0",
"}"
],
"description": "John basic For Loop"
},
"IIFE-John-basic": {
"prefix": "j_iife-john-basic",
"body": [
"(function() {",
"\t$0",
"})();"
],
"description": "John basic IIFE (Immediately Invoked Functional Expression)"
},
"GlideRecord Query - John": {
"prefix": "j_gr",
"body": [
"var gr = new GlideRecord('$1');",
"gr.addQuery('$2');",
"gr.query();",
"while (gr.next()) {",
"\t$0",
"}"
],
"description": "John GlideRecord query and loop results"
},
"IIFE": {
"prefix": "e_iife",
"body": [
"var ${1:moduleName} = (function() {",
"\tvar results = {}",
" ",
"\tfunction ${2:myFunc1}() {",
"\t//do something",
"}",
" ",
"\tfunction ${3:myFunc2}() {",
"\t//do something",
"}",
" ",
"\tfunction ${4:myPrivateFunc1}() {",
"\t//do something",
"}",
" ",
"result.${5:publicFuncName1} = ${2:myFunc1}; ",
"result.${6:publicFuncName2} = ${3:myFunc2}; ",
" ",
"return results;",
"})();"
],
"description": "Standard iife revealing module pattern"
},
////////////////////////////////////////////////////
// QUERY MULTIPLE
////////////////////////////////////////////////////
"Service Now Basic Query": {
"prefix": "sn_query",
"body": [
"var gr = new GlideRecord('${1:tableName}'); //Indicate the table to query from",
"//Use sn_add to bring up addquery snippets;",
"gr.query(); //Execute the query",
"while (gr.next()) { //While the recordset contains records, iterate through them",
"\t//Do something with the records returned",
"\tif(gr.category == 'software'){",
"\t$0gs.log('Category is ' + gr.category);",
"\t$0}",
"}"
],
"description": "A standard GlideRecord query follows this format. Can also be used in Client scripts and UI policies"
},
"Service Now Query with OR Condition": {
"prefix": "sn_query_with_Or_condition",
"body": [
"var gr = new GlideRecord('${1:tableName}');",
"gr.addQuery('${2:Field1}', ${3:Value1}).addOrCondition('${4:Field2}', ${5:Value2});",
"gr.query();"
],
"description": "Basic query with chained or condition to filter results"
},
"Service Now Query with Encoded filters": {
"prefix": "sn_query_with_encoded",
"body": [
"var gr = new GlideRecord('${1:tableName}');",
"var strQuery = 'active=true';",
"strQuery = strQuery + '^category=software';",
"strQuery = strQuery + '^ORcategory=hardware';",
"gr.addEncodedQuery(strQuery);",
"gr.query();"
],
"description": "Basic query with encoded filters."
},
"Service Now Query Aggregate": {
"prefix": "sn_query_aggregate",
"body": [
"var gr = new GlideAggregate('${1:tableName}');",
"gr.addQuery('active', true);",
"gr.addAggregate('COUNT');",
"gr.query();",
"var incidents = 0;",
"if (gr.next()){",
"\tincidents = gr.getAggregate('COUNT');",
"\tgs.log('Active incident count: ' + incidents);",
"}"
],
"description": "Query aggregate data. ( Count, SUM, MIN, MAX, AVG )"
},
"Service Now Query OrderBy": {
"prefix": "sn_query_orderBy",
"body": [
"//Find all active records and order the results ascending by category then descending by created date",
"var gr = new GlideRecord('${1:tableName}');",
"gr.addQuery('active', true);",
"gr.orderBy('category');",
"gr.orderByDesc('sys_created_on');",
"gr.query();"
],
"description": "Query with order by"
},
"Service Now (Not)Null Query": {
"prefix": "sn_query_(not)null",
"body": [
"//Find all records where the field is empty",
"var gr = new GlideRecord('${1:tableName}');",
"//gr.addNotNullQuery('');",
"gr.addNullQuery('${2:field1}');",
"gr.query();"
],
"description": "Query to find where a field is null or not null"
},
"Service Now Get Row Count - serverScript": {
"prefix": "sn_query_rowcount_serverscript",
"body": [
"//Log the number of records returned by the query",
"var gr = new GlideRecord('${1:tableName}');",
"gr.addQuery('category', 'software');",
"gr.query();",
"gs.log('Incident count: ' + gr.getRowCount());"
],
"description": "Query to find the row count on a server side script"
},
"Service Now Get Row Count - clientScript": {
"prefix": "sn_query_rowcount_clientscript",
"body": [
"//Log the number of records returned by the query",
"var gr = new GlideRecord('${1:tableName}');",
"gr.addQuery('category', 'software');",
"gr.query();",
"alert('Incident count: ' + gr.rows.length);"
],
"description": "Query to find the row count on a client side script"
},
"Service Now Query with result limit": {
"prefix": "sn_query_with_resultLimit",
"body": [
"//Find the last 10 records created",
"var gr = new GlideRecord('${1:tableName}');",
"gr.orderByDesc('${2:fieldName}');",
"gr.setLimit(10);",
"gr.query();"
],
"description": "Specify a limit for the result count."
},
"Service Now Query with chooseWindow": {
"prefix": "sn_query_with_resultLimit_chooseWindow",
"body": [
"var gr = new GlideRecord('${1:tableName}');",
"gr.orderByDesc('${2:fieldname}');",
"// Results between count 10 && 20",
"gr.chooseWindow(10, 20);",
"gr.query();"
],
"description": "The chooseWindow(first,last) method lets you set the first and last row number that you want to retrieve and is typical for chunking-type operations. The rows for any given query result are numbered 0..(n-1), where there are n rows. The first parameter is the row number of the first result you’ll get. The second parameter is the number of the row after the last row to be returned. In the example below, the parameters (10, 20) will cause 10 rows to be returned: rows 10..19, inclusive."
},
////////////////////////////////////////////////////
// QUERY SINGLE
////////////////////////////////////////////////////
"Service Now Get Single Record": {
"prefix": "sn_query_single",
"body": [
"var gr = new GlideRecord('${1:tableName}');",
"gr.get(${2:sys_id_of_record});",
"//Do something with the record returned",
"if(gr.category == 'software'){",
"\tgs.log('Category is ' + gr.category);",
"}"
],
"description": "Get a specfic record"
},
"Service Now Get Single Record by field/value pair": {
"prefix": "sn_query_single_by_field/val",
"body": [
"var gr = new GlideRecord('${1:tableName}');",
"if(gr.get('${2:field}', ${3:value})){",
"\t//Do something with the first record returned",
"\tgs.log('Category is ' + gr.category);",
"}"
],
"description": "Get the first record matching the field value pair."
},
"Service Now Get Reference Record": {
"prefix": "sn_query_single_ref_record",
"body": [
"//Returns the GlideRecord for the value populated in the 'caller_id' field",
"var caller = current.caller_id.getRefRecord();",
"caller.email = 'test@test.com';",
"caller.update();"
],
"description": "Get the first record matching the field value pair."
},
////////////////////////////////////////////////////
// DELETE
////////////////////////////////////////////////////
"Service Now Delete ": {
"prefix": "sn_delete",
"body": [
"//delete them one-by-one",
"var gr = new GlideRecord('${1:tableName}');",
"gr.addQuery('${2:field}',${3:value});",
"gr.query();",
"while (gr.next()) {",
"\t//Delete each record in the query result set",
"\tgr.deleteRecord();",
"}"
],
"description": "How to delete a records."
},
"Service Now Delete All ": {
"prefix": "sn_delete_ALL",
"body": [
"//delete them all at once",
"var gr = new GlideRecord('${1:tableName}');",
"gr.addQuery('${2:field}',${3:value});",
"gr.deleteMultiple(); //Deletes all records in the record set"
],
"description": "How to delete all the records in a result set."
},
////////////////////////////////////////////////////
// INSERT
////////////////////////////////////////////////////
"Service Now Insert ": {
"prefix": "sn_insert",
"body": [
"var gr = new GlideRecord('${1:tableName}');",
"gr.initialize();",
"gr.category = 'software';",
"gr.caller_id.setDisplayValue('Joe Employee');",
"gr.insert();"
],
"description": "How to insert a new record"
},
////////////////////////////////////////////////////
// UPDATE
////////////////////////////////////////////////////
"Service Now Update ": {
"prefix": "sn_update",
"body": [
"var gr = new GlideRecord('${1:tableName}');",
"gr.addQuery('${2:field}',${3:value});",
"gr.query();",
"while (gr.next()) {",
"\tgr.active = false;",
"\tgr.update();",
"}"
],
"description": "How to update a record."
},
"Service Now Update with SetWorkflow ": {
"prefix": "sn_update_setWorkflow",
"body": [
"//Change without triggering business rules on updated records",
"var gr = new GlideRecord('${1:tableName}');",
"gr.addQuery('${2:field}',${3:value});",
"gr.query();",
"while(gr.next()){",
"\tgr.category = 'hardware';",
"\tgr.setWorkflow(false);",
"\tgr.update();",
"}"
],
"description": "‘setWorkflow’ is used to enable/disable the running of any business rules that may be triggered by a particular update."
},
"Service Now Update with autoSysFields ": {
"prefix": "sn_update_autoSysFields",
"body": [
"//Change the category of all 'software' incidents to 'hardware' without updating sys fields",
"var gr = new GlideRecord('${1:tableName}');",
"gr.addQuery('${2:field}',${3:value});",
"gr.query();",
"while(gr.next()){",
"\tgr.category = 'hardware';",
"\tgr.autoSysFields(false);",
"\tgr.update();",
"}"
],
"description": "‘autoSysFields’ is used to disable the update of ‘sys’ fields (Updated, Created, etc.) for a particular update. This really is only used in special situations. The primary example is when you need to perform a mass update of records to true up some of the data but want to retain the original update timestamps, etc."
},
"Service Now Update with setForceUpdate ": {
"prefix": "sn_update_setForceUpdate",
"body": [
"//Force an update to all User records without changing field values",
"var gr = new GlideRecord('${1:tableName}');",
"gr.query();",
"while (gr.next()) {",
"\tgr.setWorkflow(false); //Do not run business rules",
"\tgr.autoSysFields(false); //Do not update system fields",
"\tgr.setForceUpdate(true); //Force the update",
"\tgr.update();",
"}"
],
"description": "‘setForceUpdate’ is used to update records without having to change a value on that record to get the update to execute."
},
////////////////////////////////////////////////////
// Service Now Operators
////////////////////////////////////////////////////
"Starts With": {
"prefix": "sn_addquery_startswith",
"body": [
"addQuery('${1:field}', 'STARTSWITH', '${2:value}');"
],
"description": "Filter results that start with specified value."
},
"Ends With": {
"prefix": "sn_addquery_endswith",
"body": [
"addQuery('${1:field}', 'ENDSWITH', '${2:value}');"
],
"description": "Filter results that end with specified value."
},
"Contains": {
"prefix": "sn_addquery_contains",
"body": [
"addQuery('${1:field}', 'CONTAINS', '${2:value}');"
],
"description": "Filter results that contains specified value."
},
"Does not Contain": {
"prefix": "sn_addquery_does_not_contain",
"body": [
"addQuery('${1:field}', 'DOES NOT CONTAIN', '${2:value}');"
],
"description": "Filter results that does not contain specified value."
},
"IN": {
"prefix": "sn_addquery_in",
"body": [
"addQuery('${1:field}', 'IN', '${2:value1}, ${3:value2}');"
],
"description": "Field must contain the value supplied anywhere in the string provided."
},
////////////////////////////////////////////////////
// Service now Alerts Client/Server
////////////////////////////////////////////////////
"Alert Below Field Server": {
"prefix": "sn_alert_server_belowField",
"body": [
"current.${1:field}.setError(\"${2:}\");"
],
"description": "Business rule and other general use. Alert below field."
},
"Alert Top Screen Server": {
"prefix": "sn_alert_server_topscreen",
"body": [
"gs.addInfoMessage(\"${1:}\");"
],
"description": "Business rule and other general use. Alert top screen."
},
"Alert Write to text log Server": {
"prefix": "sn_alert_server_write_to_textlog",
"body": [
"gs.print(\"${1:}\");"
],
"description": "Business rule and other general use. Write to text log."
},
"Alert Write to log Server": {
"prefix": "sn_alert_server_log",
"body": [
"gs.log(\"${1:}\");"
],
"description": "Business rule and other general use. Will write to the database and the log file. Too much of this can adversely affect performance"
},
"Alert Popup Client": {
"prefix": "sn_alert_client_popup",
"body": [
"alert(\"${1:}\");"
],
"description": "Client Script - Will pop up a window with message and an 'OK' button."
},
"Alert Confirm Client": {
"prefix": "sn_alert_client_confirm",
"body": [
"confirm(\"${1:}\");"
],
"description": "Client Script - Will pop up a window with message and a 'Ok' and 'Cancel' buttons."
},
"Alert Next to field Client": {
"prefix": "sn_alert_client_errorNextToField",
"body": [
"g_form.showErrorBox(\"${1:Field}\", \"${2:Message}\");"
],
"description": "Client Script - Will put an error message below the specified field."
},
"Alert Hide Next to field Client": {
"prefix": "sn_alert_client_hide_errorNextToField",
"body": [
"g_form.hideErrorBox(\"${1:Field}\");"
],
"description": "Client Script - Will hide error message next the specified field."
},
//////////////////////////////////////////////////////////////////////////////////////
// ******************* Service Now Objects ******************************
//////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////
// Service Now Glide User Object SERVER
////////////////////////////////////////////////////
"Get User by ID Server": {
"prefix": "sn_user_server_get_UserByID",
"body": [
"var userObject = gs.getUser().getUserByID('${1:userID}');"
],
"description": "Returns a reference to the user object for the user ID (or sys_id) provided."
},
"Get Current User Server": {
"prefix": "sn_user_server_getCurrent_User",
"body": [
"var userObject = gs.getUser();"
],
"description": "Returns a reference to the user object for the currently logged-in user."
},
"Get Current Users Name Server": {
"prefix": "sn_user_server_getCurrent_UserName",
"body": [
"var user_name = gs.getUserName();"
],
"description": "Returns the User ID (user_name) for the currently logged-in user.e.g. 'employee'"
},
"Get Current Users DisplayName Server": {
"prefix": "sn_user_server_getCurrent_DisplayName",
"body": [
"var userDisplay = gs.getUserDisplayName();"
],
"description": "Returns the display value for the currently logged-in user.e.g. 'Joe Employee'"
},
"Get Current Users ID Server": {
"prefix": "sn_user_server_getCurrent_ID",
"body": [
"var userID = gs.getUserID();"
],
"description": "Returns the sys_id string value for the currently logged-in user."
},
"Get Current Users First Name Server": {
"prefix": "sn_user_server_getCurrent_FName",
"body": [
"var firstName = gs.getUser().getFirstName();"
],
"description": "Returns the first name of the currently logged-in user."
},
"Get Current Users Last Name Server": {
"prefix": "sn_user_server_getCurrent_LName",
"body": [
"var lastName = gs.getUser().getLastName();"
],
"description": "Returns the last name of the currently logged-in user."
},
"Get Current Users Email Server": {
"prefix": "sn_user_server_getCurrent_Email",
"body": [
"var email = gs.getUser().getEmail();"
],
"description": "Returns the email of the currently logged-in user."
},
"Get Current Users DepartmentID Server": {
"prefix": "sn_user_server_getCurrent_departmentID",
"body": [
"var deptID = gs.getUser().getDepartmentID();"
],
"description": "Returns the department id of the currently logged-in user."
},
"Get Current Users CompanyID Server": {
"prefix": "sn_user_server_getCurrent_companyID",
"body": [
"var companyID = gs.getUser().getCompanyID();"
],
"description": "Returns the company GlideRecord of the currently logged-in user."
},
"Get Current Users Groups List Server": {
"prefix": "sn_user_server_getCurrent_listOfGroups",
"body": [
"var groups = gs.getUser().getMyGroups();"
],
"description": "Returns a list of all groups that the currently logged-in user is a member of."
},
"Get Current User Is Member Of Server": {
"prefix": "sn_user_server_getCurrent_isMemberOF",
"body": [
"var isMember = gs.getUser().isMemberOf('${1:group}');"
],
"description": "Returns true if the user is a member of the given group, false otherwise."
},
////////////////////////////////////////////////////
// Service Now Glide User Object CLIENT
////////////////////////////////////////////////////
"Get Current User Name Client": {
"prefix": "sn_user_client_getCurrent_userName",
"body": [
"var currentUser = g_user.userName;"
],
"description": "User name of the current user e.g. employee"
},
"Get Current User First Name Client": {
"prefix": "sn_user_client_getCurrent_FName",
"body": [
"var firstName = g_user.firstName;"
],
"description": "First name of the current user e.g. Joe"
},
"Get Current User Last Name Client": {
"prefix": "sn_user_client_getCurrent_LName",
"body": [
"var lastName = g_user.lastName;"
],
"description": "Last name of the current user e.g. Employee"
},
"Get Current User ID Client": {
"prefix": "sn_user_client_getCurrent_userID",
"body": [
"var id = g_user.userID;"
],
"description": "sys_id of the current user e.g. 681ccaf9c0a8016400b98a06818d57c7"
},
"Get Current User Has Role Client": {
"prefix": "sn_user_client_getCurrent_hasRole",
"body": [
"var hasRole = g_user.hasRole('${1:role}');"
],
"description": "True if the current user has the exact role specified, false otherwise, regardless of 'admin' role. Usage: g_user.hasRoleExactly('itil')"
},
"Get Current User Has Role Exactly Client": {
"prefix": "sn_user_client_getCurrent_hasRoleExactly",
"body": [
"var hasRole = g_user.hasRoleExactly('${1:role}');"
],
"description": "True if the current user has the exact role specified, false otherwise, regardless of 'admin' role. Usage: g_user.hasRoleExactly('itil')"
},
"Get Current User Has Roles Client": {
"prefix": "sn_user_client_getCurrent_hasRoles",
"body": [
"// Returns true if user has at least one role specfifed",
"var hasRole = g_user.hasRoles('${1:role}','${2:role2}');"
],
"description": "True if the current user has at least one role specified, false otherwise."
},
////////////////////////////////////////////////////
// Service Now Glide Form Object CLIENT
////////////////////////////////////////////////////
"Form Object Add Decoration Client": {
"prefix": "sn_form_addDecoration",
"body": [
"g_form.addDecoration(${1:fieldName}, ${2:icon}, ${3:Title});"
],
"description": "Adds an icon on a field’s label."
},
"Form Object Flash Color": {
"prefix": "sn_form_flashColor",
"body": [
"g_form.flash(${1:widgetName}, ${2:color}, ${3:count});"
],
"description": "Flashes the specified color the specified number of times. Used to draw attention to a particular field."
},
"Form Object Get label of field": {
"prefix": "sn_form_getLabelOf",
"body": [
" var Label = g_form.getLabelOf('${1:field}');"
],
"description": "Gets the plain text value of the field label."
},
"Form Object Set Visibility": {
"prefix": "sn_form_setVisibility",
"body": [
"g_form.setVisible('${1:field}','${2:true}');"
],
"description": "Toggles visiblity of a field in a form."
},
"Form Object Get Value": {
"prefix": "sn_form_getFieldValue",
"body": [
"var value = g_form.getValue('${1:field}');"
],
"description": "Gets the value of a field on a form."
},
"Form Object Set Value": {
"prefix": "sn_form_setFieldValue",
"body": [
"g_form.setValue('${1:field}', \"${2:value}\");"
],
"description": "Sets the value of a field on a form."
},
"Form Object Set Mandatory": {
"prefix": "sn_form_setMandatory",
"body": [
"g_form.setMandatory('${1:field}', \"${2:value}\");"
],
"description": "Sets the Mandatory of a field on a form."
},
"Form Object Get Mandatory": {
"prefix": "sn_form_getMandatory",
"body": [
"var isMandatory = g_form.isMandatory('${1:field}');"
],
"description": "Gets bool if field is mandatory."
},
"Form Object Clear Field Value": {
"prefix": "sn_form_clearField",
"body": [
"g_form.clearValue('${1:field}');"
],
"description": "Clears the value of a field."
},
"Form Object Set Disabled Field": {
"prefix": "sn_form_setDisabled",
"body": [
"g_form.setDisabled('${1:field}', \"${2:value}\");"
],
"description": "Enable/Disable a field."
},
"Form Object Set Read Only Field": {
"prefix": "sn_form_setReadOnly",
"body": [
"g_form.setReadOnly('${1:field}', \"${2:value}\");"
],
"description": "Toggle read only on a field. Best Practice: Use UI Policy rather than this method whenever possible."
},
"Form Object Is New Record": {
"prefix": "sn_form_getIsNew",
"body": [
"var isNew = g_form.isNewRecord();"
],
"description": "Tells if this is a new record."
},
"Form Object Save & Stay": {
"prefix": "sn_form_saveNstay",
"body": [
"g_form.save();"
],
"description": "Saves the record and stays"
},
"Form Object Submit and leave": {
"prefix": "sn_form_submit_gotoprevious",
"body": [
"g_form.submit();"
],
"description": "Submits and returns user to previous screen."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment