How to get value from Inactive fields from an active table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2023 03:34 AM
I have field which has been made Inactive recently. Now, I am trying to get the value stored from the Inactive field.
I could not get the value using scripting. I have tried gliding the record
var gr = new GlideRecord('table');
gr.query();
while ( gr.next()) {
gr.getValue('Inactive field'); // This way not working.
OR
gr.Inactive_field; // This way also not working.
}
I can see the value is there, when I did the "Show XML" of the record.
Please let me know if anyone has information on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2023 03:47 AM
well it worked for me.
I have tried this on user table where last_login_device field in active=false
eg:
var geti = new GlideRecord('sys_user');
geti.addQuery('sys_id','<user_sys_id>');
geti.query();
if(geti.next()){
gs.print('inside '+geti.active);
gs.print(geti.last_login_device);
}
I think you are missing to add addQuery() where you need to specify which records inactive field you want to see
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2023 04:06 AM
Above syntax is just an example one.. I have added the addQuery condition.