Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Update software package from software instance

Not applicable

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