Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Create multiple records through Flow Designer from Record Producer

mballinger
Mega Guru

Hello,

I have a record producer with multiple Multi Row Variable Sets. I need to create a flow, when a record is created from the Flow, it needs to grab all the line items from each MRVS and create a new record.

How can I do this?

Thanks!

1 ACCEPTED SOLUTION

@mballinger 

You can also use after insert BR on your record producer target table

Sample Script below

I assume your MRVS has name and email variable

(function executeRule(current, previous /*null when async*/ ) {

	var value = current.variables.variableName;
	if(value){
		var parser = JSON.parse(value);

		for(var i=0;i<parser.length;i++){
			var gr = new GlideRecord("tablename");
			gr.initialize();
			gr.u_name = parser[i].name;
			gr.u_email = parser[i].email;
			gr.insert();
		}
	}

})(current, previous);

Regards
Ankur

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

View solution in original post

10 REPLIES 10

I used the code you provided and passed it through the RP vs the BR or a flow. Thanks again for your help!