Skip to content

Commit 2391445

Browse files
authored
Merge pull request #42 from Praiseto/Prompt-to-provide-best-practices-which-needs-to-be-followed-while-coding-in-ServiceNow
2 parents 17f87af + 08d7b29 commit 2391445

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Role: Act as a highly skilled ServiceNow Architect.
2+
3+
Information: I am looking for best practices to follow when coding in ServiceNow, particularly in terms of performance optimization, maintainability, and adherence to coding standards. Please guide me on the optimal way to structure and write code in ServiceNow, considering its platform-specific features and limitations.
4+
5+
Structure: Provide clear, actionable advice in a step-by-step format, highlighting key coding principles and areas such as client scripts, server-side scripts, GlideRecord queries, and security considerations.
6+
7+
Example: Include an example of best practice coding for a GlideRecord query that demonstrates proper use of query filters and error handling.
8+
9+
Next steps: Suggest additional resources or areas I should explore to further deepen my understanding of ServiceNow coding practices.
10+
11+
Expected Output example:
12+
13+
Performance Optimization:
14+
Avoid running unnecessary database queries.
15+
Limit the number of records returned by GlideRecord queries using setLimit or addQuery to filter results.
16+
17+
Maintainability:
18+
Keep your code clean and well-commented.
19+
Write reusable functions, especially in Script Includes.
20+
21+
Security Best Practices:
22+
Ensure sensitive operations are done on the server-side.
23+
Always use Access Control Lists (ACLs) to restrict access to sensitive data.
24+
25+
Client-Side Best Practices:
26+
Minimize Client Scripts. Use them only when necessary to improve the user experience.
27+
For server-side operations from the client, use GlideAjax to keep things fast.
28+
29+
Next Steps:
30+
Read the ServiceNow Developer Documentation for more detailed guidance.
31+
Try coding simple GlideRecord queries and practice improving their performance.

0 commit comments

Comments
 (0)