Discovered Item of the latest detection for a VIT is not reflecting on the VIT table list view.

AbhishekK212227
Tera Contributor

Hi Team,

 

For one VIT there are two records under vulnerable item detection (detections) tab. 

One record is of Stale status and another record is of Open status. Moreover, both records discovered item are different.

Ideally if one status is of stale status then automatically discovered item must be updated to the new and this should show in list view but this not happening. In list view old discovered item value is showing i.e, for the stale one.

 

We found that one resource tag is missing in the old discovered item.

 

How to add the missing resource tag with script/fix script.

we need the latest Discovered item in the list view so that the assignment can be done properly using the assignment rule.
Since the newly updated tags are not available getting updates on the older Discovered item this is causing discrepancies.

 

could anyone help me on this with script.

 

Thanks..!

9 REPLIES 9

Hi @Jainish Jain 

How did you implement this? 

 

Thanks..!

 

Regards,

Abhishek

Could you please, help me with the script with steps?

Thanks in advance.

@AbhishekK212227 Please mark it solution if it helps. Thanks

var gr = new GlideRecord("sn_vul_detection");
        gr.addEncodedQuery("status=0^vulnerable_item=" + vit.sys_id);
        gr.orderByDesc("last_found");
        gr.setLimit(1);
        gr.query();
        if (gr.next()) {

            var grVi = new GlideRecord("sn_vul_vulnerable_item");
            if (grVi.get(vit.sys_id)) {
                grVi.src_ci = gr.src_ci;
                grVi.cmdb_ci = gr.src_ci.cmdb_ci;
                grVi.setWorkflow(false);
                grVi.update();

            }
        }

Hi @Jainish Jain 

 

Will this be a fix script?

 

Hi @Jainish Jain 

 

Will this be a fix script?

 

Thanks..!

 

Regards,

Abhishek