Pulling sys_history_line field on report on sc_task

Kaju
Tera Contributor

Hi All ,

I have report for fetching sc_task records with previous assignment group A and now reassigned to different assignment group.

I have done this by using script include and calling that script include in report.

Now, I want to show that who has updated the assignment group. To achieve this for particular record, I need to show "user_name" field from sys_history_line table to the existing report on sc_task.

Do we have any solution to achieve this?

I tried with database views, but did not work. I believe , it is not recommended to have database views on sys_history_line and sys_audit tables.

Kindly suggest another option.

Thank you in advance 🙂  

5 REPLIES 5

vikrantsharma
Kilo Guru

https://community.servicenow.com/community?id=community_blog&sys_id=5ffde62ddbd0dbc01dcaf3231f961917

 

This has been a helpful for me. Please see if this is of any use for you?

You would have to change the table when you report as you would figure it out when you look at post.

 

Please mark helpful or Correct.

 

Regards,

Vikrant Sharma

Please make it correct or helpful if this solves or help you with your issue for other to make use it.

Thanks & Regards,
Vikrant Sharma

Hi ,

I have checked article

https://community.servicenow.com/community?id=community_blog&sys_id=5ffde62ddbd0dbc01dcaf3231f961917

But here they are reporting on sys_history_line table

I am looking for other possible approach to fetch the related sc_task records and want to have "user_name" field from "sys_history_table" in the same report on sc_task

Could you please suggest another possible approach to achieve this.

 

Thank you.

The requirements are quite bespoke here, If you are just looking for the previous assignment group and User who changed the assignment group only, you can go for a business rule and individual field for Previous assignment group and User making amendments to the previous assignment group, and update those fields when the assignment group changes, to capture the value for those fields.

 

OOB as you know it doesn't capture the previous assignment group and who changes the group, so you would have to write the code to get the required values unless, in future there is another requirement to get any other detail for reporting.

 

Hope this helps?

Please make it correct or helpful if this solves or help you with your issue for other to make use it.

Thanks & Regards,
Vikrant Sharma

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Hi,

You are correct about recommendation of not having database views with sys_audit or sys_history_line. I wouldn't recommend doing reports on these either. I would try to solve this by a different approach. Since I don't know the exact requirement this might be wrong, but what I'm reading here should be easy solved by a metric that saves the information and then you can use that in the report instead and even make a database view on it. And if you got Performance analytics it would be even easier.

//Göran
Feel free to connect with me:
LinkedIn & Twitter
Subscribe to my YouTube Channel
Buy The Witch Doctor's Guide To ServiceNow