Update software package from software instance

Andrew_TND
Mega Sage
Mega Sage

Hi all,

I'm struggling with this script, when a software instance is inserted or updated to create a new software package, however to also look for any duplicates but I'm either getting the result of a blank record or none at all. 

 

 

 

(function executeRule(current, previous /*null when async*/ ) {
    var spkg = new GlideRecord("cmdb_ci_spkg");
	spkg.addQuery("name", current.sys_id.toString());
    spkg.query();
    if (spkg.next()) {
        spkg.name == current.name;
        spkg.insert();
    } else {
        spkg.setAbortAction(true);
    }
})(current, previous);

 

 

 

 

0 REPLIES 0