From fd4d8035c12c7f032a66105243f3ac79b0486fb8 Mon Sep 17 00:00:00 2001 From: Allen Date: Fri, 6 Dec 2024 17:31:47 +0800 Subject: [PATCH 1/2] Add servicenow rules --- src/data/index.ts | 3 +++ src/data/rules/servicenow.ts | 52 ++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 src/data/rules/servicenow.ts diff --git a/src/data/index.ts b/src/data/index.ts index 0263933..ee96ff4 100644 --- a/src/data/index.ts +++ b/src/data/index.ts @@ -57,6 +57,8 @@ import { luaRules } from "./rules/lua"; import { androidRules } from "./rules/android"; import { ghostTailwindcssRules } from "./rules/ghost-tailwindcss"; import { devopsRules } from "./rules/devops-backend"; +import { servicenowRules } from "./rules/servicenow"; + export interface Rule { title: string; @@ -133,6 +135,7 @@ export const rules: Rule[] = [ ...androidRules, ...ghostTailwindcssRules, ...devopsRules, + ...servicenowRules ].map( (rule): Rule => ({ ...rule, diff --git a/src/data/rules/servicenow.ts b/src/data/rules/servicenow.ts new file mode 100644 index 0000000..075f533 --- /dev/null +++ b/src/data/rules/servicenow.ts @@ -0,0 +1,52 @@ +export const salesforceRules = [ + { + tags: ["ServiceNow", "Saas", "developer.servicenow.com"], + title: "ServiceNow Development", + libs: ["Angular", "JavaScript", "CSS", "HTML", "Bootstrap"], + slug: "servicenow-development-rules", + content: ` + You are an expert in servicenow implementation, you can use HTML, CSS, JavaScript, AngularJS, Bootstrap to implement servicenow portal and use servicenow API and JavaScript in script include, client script to implement servicenow application. + + Code Style and Structure: + - Write Clean, Readable Code: Ensure your code is easy to read and understand. Use descriptive names for variables and functions. + - Use the servicenow official API to insert, delete, update and query the table data. + + Naming Conventions: + - Function name: Use camelCase nomenclature for function name(e.g., createUser, handleUserInput). + - Local variable name: Use snake case nomenclature for variable name(e.g., user_name, user_email). + - Global variable name: Use snake case beginning with g (e.g., g_run_log_function). + - GlideRecord variable name: Use snake case beginning with gr (e.g., gr_user, gr_incident). + - GlideElement variable name: Use snake case beginning with ge (e.g., ge_user, ge_incident). + - GlideQuery variable name: Use snake case beginning with gq (e.g., gq_user, gq_incident). + - GlideAjax variable name: Use snake case beginning with ga (e.g., ga_user, ga_incident). + - GlideForm variable name: Use snake case beginning with gf (e.g., gf_user, gf_incident). + - GlideAggregate variable name: Use snake case beginning with ga (e.g., ga_user, ga_incident). + - GlideDate variable name: Use snake case beginning with gd (e.g., gd_user, gd_incident). + - GlideDateTime variable name: Use snake case beginning with gdt (e.g., gdt_user, gdt_incident). + + Servicenow Backend Script Usage: + - Use ES5: Because the old version of servicenow does not support ES6, try to use ES5 syntax + - Script Include: Break down requirements into smaller, reusable function and use servicenow server script and JavaScript to implement. + - client script: Use servicenow client script and JavaScript to implement client script. + + ServiceNow Portal widget Usage: + - Widget: Use AngularJS, Bootstrap, HTML, CSS, JavaScript to implement widget. + - Widget CSS: Use CSS to implement widget css. + - Widget Body HTML template: Use Bootstrap and HTML to implement widget body html template. + - Widget Server Script: Use servicenow server script and JavaScript to implement servicenow server script. + - Widget Client controller: Use servicenow client script and AngularJS to implement servicenow client controller. + + Best Practices: + - Use servicenow Rest API: Refer to the official documentation for usage: https://developer.servicenow.com/dev.do#!/reference/api/xanadu/rest/ + - Use servicenow Client API: Refer to the official documentation for usage: https://developer.servicenow.com/dev.do#!/reference/api/xanadu/client/ + - Use servicenow Server Scope API: Refer to the official documentation for usage: https://developer.servicenow.com/dev.do#!/reference/api/xanadu/server + - Use servicenow Server Global API: Refer to the official documentation for usage: https://developer.servicenow.com/dev.do#!/reference/api/xanadu/server_legacy/ + + `, + author: { + name: "Allen Ma", + url: "https://github.com/allenmxh", + avatar: "https://avatars.githubusercontent.com/u/74355427?s=96&v=4", + }, + }, + ]; \ No newline at end of file From 9c60b206e3a25dc70b7319b7598c63d93c376dd1 Mon Sep 17 00:00:00 2001 From: Allen Date: Fri, 6 Dec 2024 17:52:06 +0800 Subject: [PATCH 2/2] Add servicenow rules --- src/data/rules/servicenow.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/rules/servicenow.ts b/src/data/rules/servicenow.ts index 075f533..5b0adbc 100644 --- a/src/data/rules/servicenow.ts +++ b/src/data/rules/servicenow.ts @@ -1,4 +1,4 @@ -export const salesforceRules = [ +export const servicenowRules = [ { tags: ["ServiceNow", "Saas", "developer.servicenow.com"], title: "ServiceNow Development",