Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Query the table sys_audit

User149490
Tera Contributor

Hi,

I try to query the sys_audit table to get an old value from a specific field. My proble is the documentkey field. In this field is stored the sys_id from the record. When I use the sys_id directly, I got my result. When I use g_form.getUniqueValue(), I got no result. I use this code:

//var dockey= 'c623ccd3db625bc4dcaefe9b0c961958';    (sys_id from the record)
    var dockey = g_form.getUniqueValue();
    var olddx = new GlideRecord('sys_audit');    

    olddx.addQuery('tablename', 'u_kodak_dx_numbers');
    olddx.addQuery('fieldname', 'u_location');
    olddx.addQuery('documentkey', dockey);
    olddx.query();

    while(olddx.next()) {
        
        alert(olddx.oldvalue + ' dx audit');
    }

Have anybody an idea where my mistake is?

 

Best regards

André

1 ACCEPTED SOLUTION

Ok. You can easily do that using an After update business rule.

 

For ex if you changed the location, you can use

 

gs.addInfoMessage('+++current location++++'+current.u_location);

gs.addInfoMessage('+++old location++++'+previous.u_location);


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

6 REPLIES 6

Ok. You can easily do that using an After update business rule.

 

For ex if you changed the location, you can use

 

gs.addInfoMessage('+++current location++++'+current.u_location);

gs.addInfoMessage('+++old location++++'+previous.u_location);


Please mark this response as correct or helpful if it assisted you with your question.

User149490
Tera Contributor

it works! Thanks a lot!