Data source with type custom (Load by script) is importing only one record.

Imtiyaj Mulla
Tera Contributor

I have created a data source as custom (Load by script) type but when clicking on 

  • Test Load 20 Records
  • Load All Records ,   its processing only one record. 

Data loader script is as below :

(function loadData(import_set_table, data_source, import_log, last_success_import_time) {
    var map = {
        device_name: "",
        last_login_user: "",
        model_id: "",
        device_typ: "",
        os: "",
        last_seen: "",
        ram: "",
        serial_number: "",
        ad_site: "",
        cpus: "",
        manufacturer: "",
        os_acrhutecture: ""
    };
    import_set_table.getMaximumRows();
    import_set_table.insert(map);
})(import_set_table, data_source, import_log, last_success_import_time);
 

any insights what i am doing wrong ..?

 

Screenshot 2024-06-25 125033.pngScreenshot 2024-06-25 125059.png

1 REPLY 1

Omkar Kumbhar
Mega Sage
Mega Sage

Hello @Imtiyaj Mulla .

The empty mapping willl not be enough in this case hence it is just inserting 1 record with empty data

you need to bring in the data and map it here 

e.g

var dataList = new QRadarRestUtil();     // Calling the script include from where the data will come
   dataList.forEach(function(data) {         // this is for all the records
    var map = {
// mapping of fields
        device_name: "data.value1",
        last_login_user: "data.value2",
        model_id: "data.value3",
        device_typ: "data.value4",
        os: "data.value5",
        last_seen: "data.value6",
        ram: "data.value7",
        serial_number: "data.value8"
       
    };
    import_set_table.insert(map);
     });
 Please modifying your code according and check.
 
Thank youi,
Omkar
If I was able to help you with your case, please click the Thumb Icon and mark as Correct.