Error: Cannot convert null to an object.,Detail: Cannot convert null to an object. getting this erro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 03:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 04:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2024 08:00 AM
You need to find out which line of code is causing the error. Check if this information is available in the error message recorded in the system log. In your screenshot, only part of that message is visible. Alternatively, you can leave out different parts of the code to narrow down your search or insert gs.log() calls at various points to see how far it gets before the error occurs.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 04:08 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 07:55 PM
@saidarvenna Please see if this updated code works for you.
(function execute(inputs, outputs) {
var serialnumbers2 = [];
var cof = inputs.Currentorigin;
var gr2 = new GlideRecord('sys_attachment');
var sys2 = inputs.ritm;
gr2.addQuery('table_sys_id', sys2);
gr2.query();
if (gr2.next()) {
var parser = new sn_impex.GlideExcelParser();
var attachment = new GlideSysAttachment();
var attachmentStream = attachment.getContentStream(gr2.sys_id);
if (attachmentStream) {
parser.parse(attachmentStream);
var headers = parser.getColumnHeaders();
var coloumn = headers[0];
while (parser.next()) {
var row = parser.getRow();
var grHardware2 = new GlideRecord('alm_hardware');
grHardware2.addQuery('serial_number', row[coloumn].replace(/\s/g, ''));
grHardware2.addEncodedQuery('u_city_of_origin!=' + cof + '');
grHardware2.query();
while (grHardware2.next()) {
serialnumbers2.push(grHardware2.serial_number);
gs.info(serialnumbers2 + "abcd");
}
}
}
parser.close(); // close the stream and release the document
}
var hr1 = new GlideRecord('sc_req_item');
hr1.addQuery('sys_id', inputs.ritm);
hr1.query();
if (hr1.next()) {
hr1.work_notes = "These Serial Numbers are not satisfying the required condition : " + serialnumbers2;
hr1.update();
}
})(inputs, outputs);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 09:44 PM
It's not working