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
Try including null check of the two variables
if( and( a!isNotNullOrEmpty(local!taskAdditionalAssignee), a!isNotNullOrEmpty(local!usersOfPickerB), contains( local!taskAdditionalAssignee, ri!record['recordType!{a6f5f29e-a89e-495a-afae-702df167aa19}.fields.{d0fec037-4f71-4d05-a7ef-766635d0ff13}'] ) ), "Assignee cannot be added as additional assignee", null )
Thanks for your response but still not fulfilling my need as I have to store max 5 user but at backend level , field that should hold atleast 5 user is of text type.is it possible my field is of text type and i have to store 5 user ?
thankyou so much for your helpplease help me how can I put validations as it is not woking by this
validations: { if( and( a!isNotNullOrEmpty(local!taskAdditionalAssignee), a!isNotNullOrEmpty(local!taskAssignee), contains( touniformstring(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 ),
I have added touniformstring beacuse it was throwing error as-
local!taskAdditionalAssignee as user type and
(ri!record['recordType!{a6f5f29e-a89e-495a-afae-702df167aa19}RECT Record Tasks Sync.fields.{d0fec037-4f71-4d05-a7ef-766635d0ff13}taskAssignedTo']) as text
if you have any suggestion please let me know
error is something like this:
Interface Definition: Expression evaluation error at function 'contains' [line 275]: Invalid types, can only act on data of the same type (User, Text)
Try wrapping both variables that you are comparing with touniformstring()
not throwing any validation now-
validations: { if( and( a!isNotNullOrEmpty(local!taskAdditionalAssignee), a!isNotNullOrEmpty(local!taskAssignee), contains( touniformstring(local!taskAdditionalAssignee), touniformstring(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 ),
is there any way we can convert text type to user type?
You can use touser()
still not throwing any validations-
validations: { if( and( a!isNotNullOrEmpty(local!taskAdditionalAssignee), a!isNotNullOrEmpty(local!taskAssignee), contains( local!taskAdditionalAssignee, touser(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 ),
I tried wrapping up of both with touser
What is value in
local!taskAdditionalAssignee and
ri!record['recordType!{a6f5f29e-a89e-495a-afae-702df167aa19}RECT Record Tasks Sync.fields.{d0fec037-4f71-4d05-a7ef-766635d0ff13}taskAssignedTo']
Thankyou soma it is now working with this:
validations: { if( and( a!isNotNullOrEmpty(local!taskAdditionalAssignee), a!isNotNullOrEmpty(local!taskAssignee), contains( local!taskAdditionalAssignee, touser(local!taskAssignee) )), "Assignee cannot be added as additional assignee", null ),
Glad to hear.
can you please help me with the validation for additional assignee to not repeat same username as if we select-
A, B, C ,C
then on selection of C validation should throw
Since you are using picker, you should not be able to select same user multiple times
but it is picking when im selecting though it will not send to database but for for user interface application should be user friendly to them so if there is any posibility to put validation then it would be great from user point of view