We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

workflow editor run s

vikaskumarc
Tera Contributor
 

i have a workflow editor which i have to convert in flow designer. I have this run script how can i do this in flow designer with the help of custom action or any other thing . Which you can suggest

6 REPLIES 6

pavani_paluri
Tera Guru

Hi @vikaskumarc ,

 

You can create a new custom action with script type and pass inputs to it and add in the flow designer. The script part remains same only inputs passing will be slightly different.

 

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Pavani P

Hi Pavani i have created custom action and created inputs however it shows undefined is not a function

@vikaskumarc 

share your flow action screenshots

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

(function execute(inputs, outputs) {
  var ipAddress = inputs.parent_ritm_sys_id;
 var cat_id = inputs.cart_id;
//var ipAddress = JSON.parse(current.variables.server_details);

//var cat_id = '7b84a51987xxxxxxxxxxxxxxxxxxxxxxx3577';
gs.info('IPAddress::::'+ ipAddress);
gs.info('catId::::'+ cat_id);
var cart = new cart();
var item = cart.addItem(cat_id);
var additionalDetail='Parent Item: XOPOP Server Build' +'    Location: '+inputs.parent_ritm_sys_id()+'   Operating system: ' +inputs.operating_system();
cart.setVariable(item, 'u_class',"cmdb_ci_server");
cart.setVariable(item, 'parent_request_item',inputs.parent_ritm_sys_id);
cart.setVariable(item, 'additional_details',additionalDetail);


var parent = new GlideRecord('sc_req_item');
if (!parent.get(String(inputs.parent_ritm_sys_id))) {
  throw new Error('Parent RITM not found: ' + inputs.parent_ritm_sys_id);

}
for(var i=0;i<ipAddress.length;i++){
    var mr = ritm.variables.ci_details;
    var newRow = mr.addRow();
    newRow.ip_address=ipAddress[i].ip_address;
   }
 
ritm.work_notes = 'This request has been triggered from Server Build Request : ' + parent.number;
ritm.update();


parent.work_notes = ritm.number + ' has been submitted to run discovery';
parent.update();






})(inputs, outputs);