Find Customer Assignments
This sample shows how you can read and process Customer Assignments in a price grid:
// find 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 criteria
return api.find("C", filter)
}
Found an issue in documentation? Write to us.
Â