KB version not creating more than 2-3 if calling OOB script include "new KBVersioning().checkout()

chandan15
Tera Contributor

Hi all,

we have OOB script include which is used in UI action ->Checkout->script include[var newRecord = new KBVersioning().checkout(current);].

I am using this script include in Flow designer action to checkout and publish KB Article.

If I am manually testing action, it is working for single records, but if am using it in flow to checkout multiple KB article, it is not working, record not found error I am getting.

Action:

script-

function execute(inputs, outputs) {
  var sysID = inputs.sysid;
  var kbRecord = new GlideRecord('kb_knowledge');
  kbRecord.addQuery("sys_id", sysID);
  kbRecord.query();

  if (kbRecord.next()) {
    
    var newVersion = new KBVersioning().checkout(kbRecord);//OOB script include for create new version of KA

    if (newVersion) {
      // Capture the sys_id of the new version
      var newVersionSysID = newVersion.sys_id.toString();
      
      outputs.newver = newVersionSysID; 
    }
  }
}

execute(inputs, outputs);

chandan15_1-1693461989914.png

 

 

 

Flow:

chandan15_0-1693461964051.png

Thanks,

Chandan

 

1 REPLY 1

chandan15
Tera Contributor

Incase it's running, only one record is running.

chandan15_0-1693464896495.png