I have a multi select customer field in a record. ...
# suiteql
r
I have a multi select customer field in a record. I want the list of customers which have a custom checkbox field on the customer record as false. How can I do that in suiteQL?
The below is my query and p.customers is a multi select field. I only want the customers in that customer list (p.customers) that have the checkbox with id custentity_xyz as 'F'
Copy code
SELECT
			p.id as promo_id, 
			p.customers as customer_list, 
			c.id as group_customer_id 
		FROM 
			promotionCode AS p 
			LEFT OUTER JOIN EntityGroup AS eg ON p.customergroup = eg.id 
			LEFT OUTER JOIN EntityGroupMember AS egm ON eg.id = egm.group 
			LEFT OUTER JOIN customer AS c on egm.member = c.id 
		WHERE 
			p.isinactive = 'F' 
			AND p.isPublic = 'F' 
			AND p.custrecord_promotion_do_not_sync = 'F'
            AND p.name NOT LIKE '%PROJECT%'
            AND p.name NOT LIKE '%project%'
			AND (
				(
				egm.member is NOT NULL 
				AND c.isinactive = 'F'
				) 
				OR egm.member is NULL
			)
r
I had gone through those links, and I missed the part where they were joining with the values from a multi select field ty. It should work.
@Shai Coleman Can you help with this, got little distracted but unable to figure it out. The very first join is not working (map_promotioncode_customers ). Basically need the correct mapping table name, but unsure on how to identify it.
Copy code
SELECT
    p.id as promo_id,
    p.customers as customer_list,
FROM
    promotioncode AS p
    JOIN map_promotioncode_customers AS MAP on MAP.mapone = p.id
    JOIN customer AS cust on MAP.maptwo = cust.id
WHERE
    p.id = '181'
Getting Error : Invalid search type: map_promotioncode_customers Also tried promotionCodeEntityMap but seems its also incorrect or not available in SuiteQL not really sure on it.
s
The table
promotioncodeentitymap
isn't available via SuiteQL You can try the
BUILTIN.MNFILTER
way. I don't know much about multi select fields, as I didn't have the need to deal with them yet.