How to put validation on pickerfieldusers which can select max 5 users

Hi all,

I have a requirement as:

I have 2 pickerfieldusers as A and B where A can select max 1 user and B can select max 5 user, requirement is when we select user in A then B cannot select that user which is already selected in A and should throw validation error as "A user cannot be selected in B".

I tried putting validation as :

validations: {
if(
contains(
local!taskAdditionalAssignee,
ri!record['recordType!{a6f5f29e-a89e-495a-afae-702df167aa19}RECT Record Tasks Sync.fields.{d0fec037-4f71-4d05-a7ef-766635d0ff13}taskAssignedTo']
),
"Assignee cannot be added as additional assignee",
null
),

}

but when I open this form then as A and B both contains null value so same validation error throws comparing both A and b having null value which becomes similar

please help me how to achieve this

  Discussion posts and replies are publicly visible