- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Introduction:
ServiceNow offers endless possibilities for automation, and one of the areas where automation can shine is in updating work notes for tasks. Automating work notes not only saves time but also improves the accuracy and consistency of information. In this blog, I’ll share how I implemented a solution in my organization that automatically updates task work notes when a status call or inquiry is logged. This solution includes creating clickable hyperlinks to related call records and dynamically inserting task details.
While this is based on my organization's use case, the approach is adaptable for various other scenarios in ServiceNow.
The Use Case:
In my recent project, I was tasked with automating the process of updating task work notes whenever a user logs a status call or inquiry. The work notes needed to be updated with the call record's hyperlink and a short description of the call. Rather than manually adding these details, I decided to use a Business Rule to trigger this automation. This automation has helped Service Desk agents by eliminating the need to update the work notes manually on both the Call and Task records.
The Solution:
By leveraging a Business Rule in ServiceNow, I was able to set up an automation that updates the work notes dynamically. This approach ensures that each task automatically receives the correct information, including:
- A clickable hyperlink to the related call record.
- A brief description of the task's status.
Here’s the code I used to implement the solution:
var taskWorkNotes = 'User called in to enquire about the state of the ticket referenced from [code]<a href="' + current.getLink() + '" target="_blank">' + current.number + '</a>[/code]\n' +
'Short description of the call: ' + shortDescription;
Explanation of the Code:
-
Creating the Work Notes:
- The variable
taskWorkNotes
contains the content that will be added to the task's work notes. - It includes an HTML
<a>
tag to create a clickable hyperlink pointing to the current record (current.getLink()
). current.number
inserts the task number into the hyperlink text.- The
[code]
tag is used to escape HTML and ensure it renders properly within the work notes.
- The variable
-
Dynamic Insertion of Task Information:
- The
shortDescription
variable is dynamically inserted to include context on the status call, making the work notes more informative.
- The
Steps to Implement:
-
Create the Business Rule:
- Navigate to System Definition > Business Rules in ServiceNow.
Please find the attached screenshots.
- Navigate to System Definition > Business Rules in ServiceNow.
-
Testing:
- After setting up the rule, make sure to test it by changing the task’s status to see if the work notes update correctly with the clickable hyperlink and description.
Best Practices:
- Security Considerations: Ensure that any HTML input is sanitized to avoid security risks such as XSS (Cross-site Scripting).
- Error Handling: Consider adding error handling in your script to manage any exceptions.
- Test, Test, Test: Always thoroughly test your solution before deploying it in production to ensure that it works as expected.
Why This Solution Matters:
- Efficiency: Automating the update of work notes eliminates the need for manual updates, saving time and reducing the chance for human error.
- Improved User Experience: Clickable hyperlinks in work notes help users quickly navigate to related records.
- Scalability: The solution can be adapted to work with different task types or scenarios, such as linking to incidents, changes, or other records.
Conclusion:
By automating the process of updating work notes, you can ensure that key information—such as hyperlinks and task descriptions—are added without manual intervention. This solution not only enhances efficiency but also improves the accuracy of work notes, helping teams work faster and more effectively. Whether you’re new to ServiceNow or an experienced professional, I hope this blog has provided you with a useful approach to automating your workflows.
Note:
This solution may already be available in the ServiceNow Community, but I wanted to share this with a specific use case that I implemented at my organization. I thought it might be useful for beginners and serve as a great refresher for all the experienced ServiceNow professionals out there. If you feel this blog doesn't serve the purpose or feels like a duplicate, please feel free to comment.
If you believe the solution provided has adequately addressed your query, could you please mark it as 'Helpful'? This will help other community members who might have the same question find the answer more easily.
Thank you for your consideration! 🙏
- 1,939 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.