Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »

This sample shows how you can read and process Customer Assignments in a Price Grid:

// find the customer assignments associated to this PG (pgId contains 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)
}


  • No labels