Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagegroovy
// find the customer assignments associated to this PG (pgId iscontains the ID of the price grid)
def cas = api.find("CA", Filter.equal("assignmentId", pgId))
 
// process the customer assignments if there are any
if (cas) {
  def filters = []
  for (c in cas) {
	// create a filter from each customer assignment
    def cg = c.customerGroup
    filters.add(Filter.equal(cg.customerFieldName, cg.customerFieldValue))
  }
 
  // put the filters into a single OR filter
  def filter = filter ? Filter.or(*filters) : null
  
  // find the customers who match the filter criteris
  return api.find("C", filter)
}

...