Skip to content

Commit c1b7fa2

Browse files
authored
Merge branch 'github-page' into main
2 parents 69db86a + f1f5276 commit c1b7fa2

16 files changed

+5307
-1
lines changed

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"Bash(ls:*)",
66
"Bash(mkdir:*)",
77
"Bash(mv:*)",
8-
"Bash(rmdir:*)"
8+
"Bash(rmdir:*)",
9+
"Bash(curl:*)",
10+
"Bash(node:*)"
911
],
1012
"deny": []
1113
}

.github/workflows/pages.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# GitHub Pages deployment workflow
2+
name: Deploy GitHub Pages
3+
4+
on:
5+
push:
6+
branches: [ "main" ]
7+
pull_request:
8+
branches: [ "main" ]
9+
workflow_dispatch:
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
18+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: false
22+
23+
jobs:
24+
# Build job
25+
build:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Setup Ruby
32+
uses: ruby/setup-ruby@v1
33+
with:
34+
ruby-version: '3.1'
35+
bundler-cache: true
36+
37+
- name: Setup Pages
38+
id: pages
39+
uses: actions/configure-pages@v4
40+
41+
- name: Install dependencies
42+
run: |
43+
gem install jekyll bundler
44+
bundle init
45+
echo 'gem "jekyll", "~> 4.3"' >> Gemfile
46+
echo 'gem "minima", "~> 2.5"' >> Gemfile
47+
echo 'gem "jekyll-feed"' >> Gemfile
48+
echo 'gem "jekyll-sitemap"' >> Gemfile
49+
echo 'gem "jekyll-seo-tag"' >> Gemfile
50+
bundle install
51+
52+
- name: Build with Jekyll
53+
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
54+
env:
55+
JEKYLL_ENV: production
56+
57+
- name: Upload artifact
58+
uses: actions/upload-pages-artifact@v3
59+
60+
# Deployment job
61+
deploy:
62+
environment:
63+
name: github-pages
64+
url: ${{ steps.deployment.outputs.page_url }}
65+
runs-on: ubuntu-latest
66+
needs: build
67+
if: github.ref == 'refs/heads/main'
68+
steps:
69+
- name: Deploy to GitHub Pages
70+
id: deployment
71+
uses: actions/deploy-pages@v4

CLAUDE.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Repository Overview
6+
7+
This is the **ServiceNow Developer Program's Code Snippets Repository** - a community-driven collection of ServiceNow development code examples and utilities. The repository contains 900+ code snippets organized into 50+ categories covering all aspects of ServiceNow platform development.
8+
9+
## Repository Structure and Organization
10+
11+
### Directory Structure
12+
All code snippets follow a standardized four-level structure:
13+
```
14+
Top-Level Category/
15+
├── Sub-Category/
16+
│ ├── Specific-Use-Case/
17+
│ │ ├── README.md # Description and usage instructions
18+
│ │ ├── script.js # Main code implementation
19+
│ │ └── variant.js # Optional code variations
20+
```
21+
22+
### Top-Level Categories (REQUIRED Structure)
23+
The repository is organized into **6 major categories**. All contributions MUST use these categories:
24+
25+
- **Core ServiceNow APIs/**: Essential ServiceNow JavaScript APIs
26+
- `GlideRecord/`, `GlideAjax/`, `GlideSystem/`, `GlideDate/`, `GlideDateTime/`, `GlideElement/`, `GlideFilter/`, `GlideAggregate/`, `GlideHTTPRequest/`, `GlideModal/`, `GlideQuery/`, `GlideTableDescriptor/`
27+
28+
- **Server-Side Components/**: Server-executed code
29+
- `Background Scripts/`, `Business Rules/`, `Script Includes/`, `Script Actions/`, `Scheduled Jobs/`, `Transform Map Scripts/`, `Server Side/`, `Inbound Actions/`, `Processors/`
30+
31+
- **Client-Side Components/**: Browser-executed code
32+
- `Client Scripts/`, `Catalog Client Script/`, `UI Actions/`, `UI Scripts/`, `UI Pages/`, `UI Macros/`, `UX Client Scripts/`, `UX Client Script Include/`, `UX Data Broker Transform/`
33+
34+
- **Modern Development/**: Modern ServiceNow frameworks
35+
- `Service Portal/`, `Service Portal Widgets/`, `NOW Experience/`, `GraphQL/`, `ECMASCript 2021/`
36+
37+
- **Integration/**: External systems and data exchange
38+
- `Integration/` (original), `RESTMessageV2/`, `Import Set API/`, `Scripted REST Api/`, `Mail Scripts/`, `MIDServer/`, `Attachments/`
39+
40+
- **Specialized Areas/**: Domain-specific functionality
41+
- `CMDB/`, `ITOM/`, `Performance Analytics/`, `ATF Steps/`, `Agile Development/`, `Advanced Conditions/`, `Browser Bookmarklets/`, `Browser Utilities/`, `Dynamic Filters/`, `Fix scripts/`, `Flow Actions/`, `Formula Builder/`, `Notifications/`, `On-Call Calendar/`, `Record Producer/`, `Regular Expressions/`, `Styles/`
42+
43+
## Development Guidelines
44+
45+
### Code Quality Standards
46+
- Each snippet must include comprehensive README.md documentation
47+
- Code should be relevant to ServiceNow developers
48+
- ES2021 features are allowed but should be clearly documented
49+
- Examples should expand meaningfully on official ServiceNow documentation
50+
- Quality over quantity - low-effort submissions are rejected
51+
52+
### Contribution Requirements
53+
- **Mandatory Category Structure**: All contributions MUST use the 6 top-level categories. PRs with incorrect structure will be rejected.
54+
- **Descriptive Structure**: Changes must match pull request scope exactly
55+
- **No XML Exports**: Avoid ServiceNow record exports in favor of JavaScript code
56+
- **Documentation**: Every code snippet requires accompanying README.md
57+
- **Proper Categorization**: Place snippets in appropriate existing sub-categories within the required top-level structure
58+
59+
### File Organization
60+
- Use descriptive folder names that clearly indicate functionality
61+
- Group related code variations in the same folder
62+
- Include screenshots or examples when helpful for understanding
63+
- Maintain consistent naming conventions across similar snippets
64+
65+
## Common ServiceNow Development Patterns
66+
67+
### GlideRecord Usage
68+
- Most snippets demonstrate proper GlideRecord query patterns
69+
- Security considerations with ACL enforcement examples
70+
- Performance optimization through proper query construction
71+
- Reference field handling and relationship traversal
72+
73+
### Integration Patterns
74+
- REST API consumption and production examples
75+
- Authentication handling for external systems
76+
- Data transformation and mapping utilities
77+
- Error handling and logging best practices
78+
79+
### Business Logic Implementation
80+
- Business Rules for event-driven processing
81+
- Background Scripts for administrative tasks
82+
- Client Scripts for form behavior and validation
83+
- UI Actions for custom user interactions
84+
85+
## Testing and Validation
86+
87+
### Code Verification
88+
- Test all code snippets in development environments before submission
89+
- Validate against multiple ServiceNow versions when possible
90+
- Consider security implications and access controls
91+
- Document any prerequisites or dependencies
92+
93+
### Community Review Process
94+
- All contributions undergo peer review by Developer Advocates
95+
- Changes outside described scope result in rejection
96+
- Multiple submissions require separate branches in forked repositories
97+
98+
## Security Considerations
99+
100+
- Never include sensitive information (passwords, API keys, tokens)
101+
- Consider security implications of all code examples
102+
- Demonstrate proper access control patterns where applicable
103+
- Include warnings for potentially dangerous operations
104+
105+
## Repository Maintenance
106+
107+
### Branch Management
108+
- Main branch contains all approved code snippets
109+
- Use descriptive branch names for contributions
110+
- Create separate branches for different feature additions
111+
112+
### File Management
113+
- No build processes or compilation required
114+
- Direct GitHub editing supported
115+
- Git-enabled IDEs like VS Code recommended for larger contributions
116+
- Standard .gitignore excludes only .DS_Store files
117+
118+
This repository serves as a comprehensive reference for ServiceNow developers at all skill levels, emphasizing practical, tested solutions for real-world development scenarios.

0 commit comments

Comments
 (0)