-
Notifications
You must be signed in to change notification settings - Fork 683
Nag code snippets day31 new #1612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
nag39g
wants to merge
7
commits into
ServiceNowDevProgram:main
from
nag39g:Nag-CodeSnippets-Day31-New
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8615d42
Create code.js
nag39g c1f15fa
Create readme.md
nag39g 8a48ea6
Reusable function to get the count of cancelled sc tasks for a RITM
nag39g 34a977f
Asynchronous Callback API for Request Fulfilment
nag39g 88f0d5b
Asynchronous Callback API for Request Fulfilment
nag39g 03dbd8d
Change Priority field color when it is critical on Incident form
nag39g 8986602
Change Priority field color when it is critical on Incident form
nag39g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
Client Scripts/Change Priority field color when it is critical on Incident form/code.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function onLoad() { | ||
// the value of priority | ||
var priority = g_form.getValue('priority'); | ||
|
||
if (priority == '1') { // for critical | ||
// Highlight the Priority field in red | ||
g_form.setFieldStyle('priority', 'background-color', 'red'); | ||
g_form.setFieldStyle('priority', 'color', 'white'); // Optional: change text color for visibility | ||
} else { | ||
// Reset to default if not high priority | ||
g_form.setFieldStyle('priority', 'background-color', ''); | ||
g_form.setFieldStyle('priority', 'color', ''); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ipts/Change Priority field color when it is critical on Incident form/readme.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This will help to grab the agents and any user attention when ever any critical incident is created so the color of the priority field will be in red color. |
10 changes: 10 additions & 0 deletions
10
GlideAggregate/Reusable function to get the count of cancelled sc tasks for a RITM/code.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function getCancelledSctasks(ritm){ | ||
var svtaskGA = new GlideAggregate("sc_task"); | ||
svtaskGA.addEncodedQuery("parent="+ritm+"^state=4^ORstate=7"); | ||
svtaskGA.addAggregate("COUNT"); | ||
svtaskGA.query(); | ||
if(svtaskGA.next()) | ||
{ | ||
return svtaskGA.getAggregate("COUNT"); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...e/Reusable function to get the count of cancelled sc tasks for a RITM/readme.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This function can be re used in anywhere to get the count of cancelled sc tasks for a given ritm with glide aggregate method which will improve the performance. | ||
Glide aggregate rund the query at database level whoch will improve the performance. |
22 changes: 22 additions & 0 deletions
22
Integration/Asynchronous Callback API for Request Fulfilment/code.js
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not code... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Proposed Solution: | ||
|
||
1. Synchronous Outbound Integration: | ||
> Utilize the REST integration step within the Flow Designer to send request details to the third-party endpoint. | ||
> The third-party system is expected to send an acknowledgment upon receiving the request, confirming that it is being processed. | ||
2. Status Tracking: | ||
> Introduce a new field or leverage an existing field in the sc_req_item table (or another relevant table) to track fulfilment status, with choice values such as "Success" or "Failure." | ||
3. Inbound Import Set API: | ||
> Create an Inbound Import Set API that allows the third-party system to send updates back to ServiceNow. The fields in the import set table should include: | ||
Request Number: A unique identifier for the request. | ||
Fulfilment Status: The status of the fulfilment (e.g., Success or Failure). | ||
Work Notes: Additional comments or information regarding the fulfilment process. | ||
4. Transform Map: | ||
> Establish a Transform Map where: | ||
a. Source Table: The Import Set Table that receives the status updates. | ||
b. Target Table: The sc_req_item table (or another relevant table based on the use case). | ||
c. Define field mappings to ensure accurate data transfer and use coalescing on the Request Number to allow updates only. | ||
d. Map the fulfilment status field from import set to new custom field to store the fulfilment status in sc_req_item table. | ||
5. Flow Changes: | ||
> Update the request stage based on the integration fulfilment status value | ||
6. API Sharing: | ||
> Provide the Inbound Import Set API to the third-party system, enabling it to send fulfilment status updates once the fulfilment process is complete. |
12 changes: 12 additions & 0 deletions
12
Integration/Asynchronous Callback API for Request Fulfilment/readme.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
When a request is created in ServiceNow, it is essential to send the request details to a third-party system via an API gateway (such as GAMS or API Gateway) for fulfilment activities, such as access provisioning or record creation. Given the potential for lengthy processing times due to a high volume of activities, a synchronous integration may lead to timeouts. Therefore, leveraging asynchronous integration allows for efficient handling of such requests. | ||
|
||
|
||
Benefits of Asynchronous Callback API: | ||
• Enhanced Performance: Asynchronous processing minimizes the risk of timeouts, ensuring that requests are handled efficiently, even when high volumes of activities are present. | ||
• Improved User Experience: Users are not left waiting for synchronous responses; instead, they can continue working while the third-party system processes their requests. | ||
• Reliable Status Tracking: The introduction of a dedicated status field allows for effective tracking of fulfilment outcomes, facilitating better communication with users regarding the success or failure of their requests. | ||
• Scalability: This approach can easily scale to accommodate increased workloads and additional integrations with other systems, enhancing overall operational capacity. | ||
• Flexibility in Integration: By decoupling request sending and status receiving, organizations can adapt to changes in third-party processes without disrupting their internal workflows. | ||
|
||
This asynchronous callback API solution not only streamlines the integration process but also ensures that ServiceNow can effectively manage and track request fulfilment in a robust and user-friendly manner. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method does not exist in UI16 or Next Experience