Is there a way to query sys_history_line by record ID?

Justin1
Kilo Expert

Looking to find all field value changes for a record in sys_history_line. Is there a way to query for a specific record? 

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hi,

You can, you can query through script with something like:

var gr = new GlideRecord('sys_history_line');
gr.addQuery('id', 'sys_id_of_record_here');
gr.query();
if (gr.next()) {
Do this...
}

Not sure in what context you're looking at those field changes, but you can reach it via script using the above, or simply go to the sys_history_line table and look at the "Set" column for a particular record.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

3 REPLIES 3

Allen Andreas
Administrator
Administrator

Hi,

You can, you can query through script with something like:

var gr = new GlideRecord('sys_history_line');
gr.addQuery('id', 'sys_id_of_record_here');
gr.query();
if (gr.next()) {
Do this...
}

Not sure in what context you're looking at those field changes, but you can reach it via script using the above, or simply go to the sys_history_line table and look at the "Set" column for a particular record.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi again,

Just wanted to check-in on this. If I've helped guide you correctly, please mark that reply as Correct. This helps others in the community see the correct answer (at least for you) easily.

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi,

It's been a bit since my reply was posted. I just wanted to check-in and see how things are going.

If my reply helped guide you correctly, please mark it as Helpful & Correct.

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!