How to create a search to find out the GL Impact changes within a record.

var itemfulfillmentSearchObj = search.create({

  type: “itemfulfillment”,

  filters:

  [

   [“type”,”anyof”,”ItemShip”], 

   “AND”, 

   [“posting”,”is”,”T”], 

   “AND”, 

   [“systemnotes.field”,”anyof”,”TRANDOC.IMPACT”], 

   “AND”, 

   [“systemnotes.newvalue”,”isnotempty”,””], 

   “AND”, 

   [“shipping”,”is”,”F”], 

   “AND”, 

   [“taxline”,”is”,”F”], 

   “AND”, 

   [“cogs”,”is”,”F”], 

   “AND”, 

   [“systemnotes.name”,”anyof”,”-4″], 

   “AND”, 

   [“mainline”,”is”,”F”], 

   “AND”, 

   [“systemnotes.date”,”within”,”today”]

  ],

  columns:

  [

   search.createColumn({

     name: “date”,

     join: “systemNotes”,

     label: “Date”

   }),

   search.createColumn({

     name: “name”,

     join: “systemNotes”,

     label: “Set by”

   }),

   search.createColumn({

     name: “field”,

     join: “systemNotes”,

     label: “Field”

   }),

   search.createColumn({

     name: “oldvalue”,

     join: “systemNotes”,

     label: “Old Value”

   }),

   search.createColumn({

     name: “newvalue”,

     join: “systemNotes”,

     label: “New Value”

   })

  ]

});

var searchResultCount = itemfulfillmentSearchObj.runPaged().count;

log.debug(“itemfulfillmentSearchObj result count”,searchResultCount);

itemfulfillmentSearchObj.run().each(function(result){

  // .run().each has a limit of 4,000 results

  return true;

});

Leave a comment

Your email address will not be published. Required fields are marked *