Skip to content

Commit 08d7b29

Browse files
authored
Create Prompt to provide best practices which needs to be followed while coding in ServiceNow
This prompt asks an AI to act as a ServiceNow Architect and provide best practices for writing efficient and maintainable code within the ServiceNow platform. It focuses on optimizing performance, adhering to coding standards, ensuring security, and maintaining clean code. Additionally, the AI is expected to give an example of a simple GlideRecord query with best practices and suggest next steps for learning more about ServiceNow development. The RISEN framework guides the AI to deliver structured, actionable insights, ensuring clarity and practical value.
1 parent 57d0ca5 commit 08d7b29

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)