{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":20000,"path":"impact/real-time-prevention-monitoring.md","title":"Use Real-time prevention monitoring while coding","bundle":null,"doc_type":null,"release":"australia","body":"\n# Use Real-time prevention monitoring while coding\n\nAs you write and save code, the Scan Engine detects violations in real-time and displays findings inline. You can then generate an AI-suggested fix before committing your changes.\n\n## Before you begin\n\nReal-time prevention monitoring must be enabled on the Scan Engine properties page.\n\n**Note:** See  for the tables that are supported.\n\nRole required:\n\n-   sn\\_se.scan\\_engine\\_user \\(view findings and prevention messages\\)\n-   sn\\_impact\\_gen\\_ai\\_fix\\_user: \\(access AI-generated code fix capabilities\\)\n\n## About this task\n\nReal-time prevention monitoring detects coding violations the moment you save a record. This allows you to fix issues immediately, preventing technical debt before your code is promoted to a higher environment. The Scan Engine checks your code against active scan definitions and displays findings inline along with AI-suggested fixes you can apply.\n\n## Procedure\n\n1.  Open your script record and make code changes as you normally would.\n\n2.  Select **Save**.\n\n    -   The Scan Engine validates your code against active scan definitions. If no violations are found, your record saves.\n    -   If violations are detected, a message displays and a findings panel opens on the right side of your screen. The findings are organized into tabs by enforcement level.\n    \\[Omitted image \"remediation-open-record-side-panel.png\"\\] Alt text: Findings message and side panel.\n\n3.  Review the findings displayed in the panel with the following information.\n\n    |Field|Description|\n    |-----|-----------|\n    |Severity label|Enforcement level and impact level of the finding. For example, Act \\| impact level-8.|\n    |Definition|Definition ID and description of the violation detected. A link to the violation is included.|\n    |Details|Location where the violation was detected, including the line number and field name.|\n    |Steps to resolve issue|Recommended actions to fix the violation.|\n    |Supporting documentation|Link to knowledge base articles or documentation explaining the general guidelines for t0.his finding.|\n    | | |\n\n    The findings panel organizes violations into tabs by enforcement level:\n\n    -   Act: Must be resolved before the record can be saved.\n    -   Recommend: Prevent saving the record unless the issue is resolved or an exception reason is provided.\n    -   Suggest: Doesn't prevent saving the record, but resolving the issues helps avoid technical debt.\n4.  Choose one of the actions to resolve each finding.\n\n<table><thead><tr><th>\n\nOption\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nManually Fix\n\n</td><td>\n\nReview the **Steps to resolve issue** guidance. Fix the code in the script editor and save again to verify the issue is resolved.\n\n</td></tr><tr><td>\n\nGenerate an AI-Suggested Fix\n\n</td><td>\n\nSelect **Generate fixes** to have AI automatically analyze your code and generate a correction.\n\n</td></tr><tr><td>\n\nView finding details\n\n</td><td>\n\nOpens the code comparison window to analyze the suggested fixes more closely.\n\n</td></tr><tr><td>\n\nSubmit an Exception \\(Recommend level findings only\\)\n\n</td><td>\n\nIf you believe the finding is a false positive or the code has a valid business reason for the violation, select **Create exception** on the specific entry.**Note:** See [Submit exceptions for Scan Engine findings](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/impact/submitting-exception-reasons-scan-engine.md) for details.\n\n</td></tr></tbody>\n</table>5.  If you chose to generate an AI-suggested fix, review the code suggestions in the ServiceNow Otto panel.\n\n    \\[Omitted image \"se-otto-panel-fixes.png\"\\] Alt text: Code suggestion view showing original code and AI-suggested changes in the ServiceNow Otto panel.\n\n    Your original code displays and the suggested changes are color-coded: green indicates added code and pink indicates removed code. The script editor is read-only until you accept or reject the fix.\n\n6.  Decide how to proceed with the AI-suggested fix.\n\n<table><thead><tr><th>\n\nOption\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n**Accept the solution**\n\n</td><td>\n\n-   Applies the AI-suggested changes.\n-   Otto updates your code and the change appears in your active update set.\n-   A full audit trail is recorded, including who accepted the fix and when.\n\n\n</td></tr><tr><td>\n\n**Reject the solution**\n\n</td><td>\n\n-   The code editor becomes editable again and you can manually fix the issue.\n-   No changes are applied.\n\n\n</td></tr><tr><td>\n\nMake additional changes\n\n</td><td>\n\n-   Describe the change you want in the revision prompt.\n-   For example, type \"Make it simpler with asynchronous callback.\"\n-   Otto regenerates the fix based on your feedback and you review again.\n\n\n</td></tr></tbody>\n</table>7.  After accepting a fix, verify the change is correct by reviewing the finding record and your updated code.\n\n    The finding is marked as resolved. If multiple findings exist, the findings panel remains visible until all are addressed or dismissed. You can then save the record normally.\n\n\n## Result\n\nYour code violation is fixed and the change is saved in your active update set. The finding no longer displays when you save the record again.\n\n**Note:** Understanding AI Finding Details: If you want a less technical explanation of why the violation was flagged and how the fix resolves it, select **View AI Finding Details** in the findings panel. This opens the AI panel with an explanation of the guideline, why your code violates it, what changed in the fix, and why the fix is correct.\n\n"}}