jon-merchant
9/8/2018 - 11:22 PM

reorderOrder_003.js

function resetOrder(catID,iteration) {

	/*Grab all variables on a Catalog Item/Record Producer and reset the order value by the iteration
	* catID: string [catalog item sys_id]
	* iteration: int [5, 10, 100]
	*/

	var a = [];
	var b = [];
	var n = 0;
	var x = 0;

	var gr = new GlideRecord('item_option_new');
	gr.addEncodedQuery('cat_item='+catID);
	gr.orderBy('order');
	gr.query();
	while(gr.next()) {
		a.push({
			sys_id:gr.getUniqueValue(),
			oldOrder:gr.getDisplayValue('order')
		});
		n++;
		x = n*iteration;
		b.push(x);
	}
  //b[{100},{200},{300}]

}

//resetOrder('02c78de49f331200d9011977677fcf76',100);