Create multiple RITM's from excel using flow designer with out empty records

AnilM99
Tera Expert

Hi Team,

We have to create multiple RITM's from EXCEL using flow designer. I used Transform map onComplete Script.

Script: 

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

    var impSet = import_set.sys_id ;

    var cartId = GlideGuid.generate(null);
    var cart = new Cart(cartId);
    var gr = new GlideRecord('u_ritmload'); // give your staging table here
    gr.addQuery('sys_import_set='+impSet);
    gr.query();
    while (gr.next()) {

       var item = cart.addItem('1391a4db070630100b36f6fd7c1ed0c2', 1); //give the catalog item sysid
        cart.setVariable(item, 'mutliline', gr.u_col1 ); //add all your variable details here
        cart.setVariable(item, 'mutliline', gr.u_col2 ); //add all your variable details here

    }
    var req_id = cart.placeOrder();
    gs.info("number"+req_id.number);

})(source, map, log, target);

 

The above script is working when i am using data load and run the transform map.

if am using the flow designer, the empty records are creating and the same RITM numbers are mapped to import set Target record

AnilM99_0-1734946314844.png

AnilM99_1-1734946352765.png

 

My flow Designer is:

AnilM99_2-1734946458769.png

 

help me on the process.

Thanks,

Anil!

 

6 REPLIES 6

@AnilM99 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@AnilM99 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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