How to add the user's group next to his display name in the activity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 03:50 AM
Hi,
Im trying to add the user's group name next to his display name in the activity inside incident's form. I know that the sys_history_line table stores all relevant data when an action is taken on the incident. I tried to write onAfter Business rule that will change the user_name (type string) to the '123' (just for testing) and its not working, But when I go to the sys history line and change the user_name to '123' manually, it also changes in the activity. Why the BR is not working and when I changed manually its working?
Before changing Manually (My display name is being displayed after changing state):
sys_history_line table with the upadate (BR does not work):
changing value manually in sys_history table (user_name = '123'):
Incident activity ('123' is being shown):
This is the BR that its not working (I tried to do both on before and on after):
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 05:24 AM
You cannot update the record in history/audits table also its not a good practice to update something
The sys_history_set and sys_history_line tables are 'populated' as needed by ServiceNow based on the data in the sys_audit table.
The sys_history_set, sys_history_line, and sys_audit tables serve as integral parts of the internal ServiceNow code. The code in the GlideHistorySet API is used exclusively by ServiceNow in various out-of-box scripts, however, the methods in the API are not intended for customer use. If a customer attempts to implement a method in the GlideHistorySet API, or to change the values or suppress the update of a record in those tables, then an unexpected result or an error may occur.
Customer support does not support the customer's use of the GlideHistorySet API, or any modification to the normal operations or values in the ServiceNow tables sys_history_set, sys_history_line, or sys_audit tables.'
Please refer this link for more info: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0692672
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 05:26 AM
You can do something like this:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 05:31 AM
@Prince Arora but this solution is only for comments, what if the user changed the state of the incident ? why the BR on the sys_history_line table does not work and when I changed it manually it works? I understand what you are saying regard the OOB functionalit but I still want to fill this requirement. How can I achieve that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 05:36 AM