Field validation - check values in separate list
AnsweredHi all,
I’d like to add a validation check to a field on one of my forms that checks whether the input matches any value in a column in another list. I understand this is possible using the Web QueryList functions, but I am a novice with Java so require some guidance.
(Unfortunately I cannot use a LookUp field instead as I have other processes that add list items via Action Builder and LookUp fields cannot be populated in this process.)
Many Thanks
-
Hi Adam Davies,
to achieve this you can use the following Validation Expression. Simply replace the words in bold.
[[@Web.QueryList('OtherList', '<Where><Eq><FieldRef Name="Title" /><Value Type="Text">[[Title]]</Value></Eq></Where>', 1, 'Title', '')]].length>0
This case is valid if an item with the same title already exists in the other list. If you need it the other way around use this expression:
[[@Web.QueryList('OtherList', '<Where><Eq><FieldRef Name="Title" /><Value Type="Text">[[Title]]</Value></Eq></Where>', 1, 'Title', '')]].length<1
Cheers Matt
0
Please sign in to leave a comment.
Comments
1 comment