var soldProductSIDHash = {};
var piSIDHash = {};
var slvList;
processImportSetRows();
function processImportSetRows() {
var PiName = "";
//var query = 'sys_updated_on>=javascript:gs.beginningOfYesterday()^sold_productISNOTEMPTY^characteristic=760e52d38798d91084b2a18e0ebb35dc^ORcharacteristic=26cd52538798d91084b2a18e0ebb35f4^ORcharacteristic=50fd52d38798d91084b2a18e0ebb35d9^sys_updated_onRELATIVEGT@hour@ago@24'; // ********************
var query = 'sys_updated_on>=javascript:gs.beginningOfYesterday()^sold_productISNOTEMPTY^characteristic=760e52d38798d91084b2a18e0ebb35dc^ORcharacteristic=26cd52538798d91084b2a18e0ebb35f4^ORcharacteristic=50fd52d38798d91084b2a18e0ebb35d9^characteristic_valueINPL0001270180';// ********************
var chargr = new GlideRecord('sn_prd_invt_product_characteristics');
chargr.addEncodedQuery(query);
chargr.query();
while (chargr.next()) {
soldProductSIDHash[chargr.sold_product + ''] = 1;
}
if (soldProductSIDHash) {
parentProductmap(soldProductSIDHash);
}
}
function parentProductmap(sidHash) {
for (var hash in sidHash) {
if (slvList) {
slvList += hash + '' + ',';
} else {
slvList = hash + '' + ',';
}
}
runParentproduct(slvList);
}
function runParentproduct(slvList1) {
var queryy = 'account.u_account_type=Billing Account (BAN)^sys_idIN' + slvList1; // ********************
var piGr = new GlideRecord('sn_prd_invt_product_inventory');
piGr.addEncodedQuery(queryy);
piGr.query();
while (piGr.next()) {
//piSIDHash[piGr.sys_id] = piGr.u_g_location + '';
piSIDHash[piGr.sys_id] = 1;
}
processHash(piSIDHash);
}
function processHash(piSIDHash) {
for (var piRow in piSIDHash) {
var rec;
if (rec) {
rec += piRow + '' + ',';
} else {
rec = piRow + '' + ',';
}
}
var queryChar = 'characteristic=760e52d38798d91084b2a18e0ebb35dc^ORcharacteristic=26cd52538798d91084b2a18e0ebb35f4^ORcharacteristic=50fd52d38798d91084b2a18e0ebb35d9^sold_productIN' + rec; // ********************
// gs.info("Charquery - " + queryChar);
deleteCharacteristics(queryChar);
}
function deleteCharacteristics(enQuery) {
var dlChar = new GlideRecord('sn_prd_invt_product_characteristics');
dlChar.addEncodedQuery(enQuery);
dlChar.query();
//gs.info("deleteCharCount - " + dlChar.getRowCount());
dlChar.deleteMultiple();
}
*************************************************
var soldProductSIDHash = {};
var piSIDHash = {};
var slvList;
processImportSetRows();
function processImportSetRows() {
var PiName = "";
//var query = 'sys_updated_on>=javascript:gs.beginningOfYesterday()^sold_productISNOTEMPTY^characteristic=3f04d6538758d91084b2a18e0ebb35eb^sys_updated_onRELATIVEGT@hour@ago@24';
var query = 'sys_updated_on>=javascript:gs.beginningOfYesterday()^sold_productISNOTEMPTY^characteristic=3f04d6538758d91084b2a18e0ebb35eb^characteristic_valueINPL0001270180';
var chargr = new GlideRecord('sn_prd_invt_product_characteristics');
chargr.addEncodedQuery(query);
chargr.query();
while (chargr.next()) {
soldProductSIDHash[chargr.sold_product + ''] = 1;
}
if (soldProductSIDHash) {
parentProductmap(soldProductSIDHash);
}
}
function parentProductmap(sidHash) {
for (var hash in sidHash) {
if (slvList) {
slvList += hash + '' + ',';
} else {
slvList = hash + '' + ',';
}
}
runParentproduct(slvList);
}
function runParentproduct(slvList1) {
var queryy = 'u_a_locationISNOTEMPTY^sys_idIN' + slvList1;
var piGr = new GlideRecord('sn_prd_invt_product_inventory');
piGr.addEncodedQuery(queryy);
piGr.query();
while (piGr.next()) {
//piSIDHash[piGr.sys_id] = piGr.u_a_location + '';
piSIDHash[piGr.sys_id] = 1;
}
processHash(piSIDHash);
}
function processHash(piSIDHash) {
for (var piRow in piSIDHash) {
var rec;
if (rec) {
rec += piRow + '' + ',';
} else {
rec = piRow + '' + ',';
}
}
var queryChar = 'characteristic=3f04d6538758d91084b2a18e0ebb35eb^sold_productIN' + rec;
//gs.info("Charquery - " + queryChar);
deleteCharacteristics(queryChar);
}
function deleteCharacteristics(enQuery) {
var dlChar = new GlideRecord('sn_prd_invt_product_characteristics');
dlChar.addEncodedQuery(enQuery);
dlChar.query();
//gs.info("deleteCharCount - " + dlChar.getRowCount());
dlChar.deleteMultiple();
}
****************************************************************888
var soldProductSIDHash = {};
var piSIDHash = {};
var slvList;
processImportSetRows();
function processImportSetRows() {
var PiName = "";
//var query = 'sys_updated_on>=javascript:gs.beginningOfYesterday()^sold_productISNOTEMPTY^characteristic=2e14d6538758d91084b2a18e0ebb35ee^sys_updated_onRELATIVEGT@hour@ago@24'; //*****************
var query = 'sys_updated_on>=javascript:gs.beginningOfYesterday()^sold_productISNOTEMPTY^characteristic=2e14d6538758d91084b2a18e0ebb35ee^characteristic_valueINPL0001270180';//*****************
var chargr = new GlideRecord('sn_prd_invt_product_characteristics');
chargr.addEncodedQuery(query);
chargr.query();
while (chargr.next()) {
soldProductSIDHash[chargr.sold_product + ''] = 1;
}
if (soldProductSIDHash) {
parentProductmap(soldProductSIDHash);
}
}
function parentProductmap(sidHash) {
for (var hash in sidHash) {
if (slvList) {
slvList += hash + '' + ',';
} else {
slvList = hash + '' + ',';
}
}
runParentproduct(slvList);
}
function runParentproduct(slvList1) {
var queryy = 'u_g_locationISNOTEMPTY^sys_idIN' + slvList1; //*****************
var piGr = new GlideRecord('sn_prd_invt_product_inventory');
piGr.addEncodedQuery(queryy);
piGr.query();
while (piGr.next()) {
//piSIDHash[piGr.sys_id] = piGr.u_g_location + '';
piSIDHash[piGr.sys_id] = 1;
}
processHash(piSIDHash);
}
function processHash(piSIDHash) {
for (var piRow in piSIDHash) {
var rec;
if (rec) {
rec += piRow + '' + ',';
} else {
rec = piRow + '' + ',';
}
}
var queryChar = 'characteristic=2e14d6538758d91084b2a18e0ebb35ee^sold_productIN' + rec; - //*****************
// gs.info("Charquery - " + queryChar);
deleteCharacteristics(queryChar);
}
function deleteCharacteristics(enQuery) {
var dlChar = new GlideRecord('sn_prd_invt_product_characteristics');
dlChar.addEncodedQuery(enQuery);
dlChar.query();
//gs.info("deleteCharCount - " + dlChar.getRowCount());
dlChar.deleteMultiple();
}
No comments:
Post a Comment