Skip to main content

I have two Person or Group fields in a list and Nintex Form, and I want to prevent the user from entering the same name in both

fields.  In the Validation Rule for the PrimaryOwner field, I have tried:

 

userEquals({ItemProperty:PrimaryOwner},{ItemProperty:SecondaryOwner})
Result: NEVER evaluates to true.  I tried the same person and different people in the two fields.

 

If(userEquals({ItemProperty:PrimaryOwner},{ItemProperty:SecondaryOwner}),1,0)
Result: Same as above

 

equals({ItemProperty:PrimaryOwner},{ItemProperty:SecondaryOwner})
Result: ALWAYS evaluates to true.  I tried the same person and different people in the two fields.

 

If(equals({ItemProperty:PrimaryOwner},{ItemProperty:SecondaryOwner}),1,0)
Result: Same as above

 

Here's the odd part - I even tried comparing the field against itself (PrimaryOwner in both parts of the formula) and the results

are still as shown above.  So I must be missing something about how this works.

 

Is there a way to observe what is being returned from a validation formula in Nintex Forms?  It would be easier to analyze if I

know what the validation formula is returning.  Thanks!

 

(Nintex Forms 2.4.1.0)

Steve Amico​, I tried to find a case with your issue creating a POC.

It worked fine on my sample, then I remembered that something similar happened me on another context.

Currently I am writting a post so as to advice how to make that comparison.


OK - thanks, Fernando - I will read your post when you publish it.


Take a look at this >>> Comparing Person Columns on a formula


Thanks, Fernando.  I took a look at this and have a few comments.

(1) This is close to my case, but not exactly.  I used a rule on the PrimaryOwner field, and you used a calculated form field.  It seems that what is being tested is the formula, so I guess this should be a valid test.  My two Person or Group fields do indeed have the same format: the "Show field" value is set to "Name (with presence)".

(2) In the case that worked for you - did you also try populating the two fields with different people?  Did it evaluate to true or false?  When I did my testing, I got the same results regardless of whether the fields were the same or different.  I found that "userEquals" always evaluated to false and "equals" always evaluated to true, regardless of the field values.

Thanks for looking at this!


Yes, it evaluated to true or false, and works fine with different users because the formula is converted to a string.

I suggest you to use a formula and use it on your rules


OK, thanks, Fernando.  I created a Nintex Form Calculated Value control, and it now looks identical to yours "equals(Primary Owner,Secondary Owner)".  My results are consistent with what I had when using the Validation Rule.  Regardless of the value of the fields, "equals" always evaluates to True.  I can use the same name in the two fields or different names in the two fields and it always returns True.  The "Show field" property is the same for both "Person or Group" fields: "Name (with presence)".

I also then created another Nintex Form Calculated Value control for "userEquals", which is "userEquals(Primary Owner,Secondary Owner)".  This doesn't display any value on the form at all.  I can use the same name in the two fields or different names in the two fields, and nothing is displayed on the form.

I tried this both in Preview mode and also as a published form.  I guess I am still missing something because it seems that this should be a simple formula that evaluates to true or false.  Maybe there is something unusual about comparing "Person or Group" fields.


Hi Steve,

 

Looks like you're pretty close. Please make sure you are not using the 'Item Property' tab when selecting the values to compare, but are using the 'Named Controls' tab to compare the correct run-time output.

 

Secondly, I'd recommend using a Calculated Value control with the output of the 'Named Control' so you can test how Nintex Forms actually renders the value.

 

For Example:

 

I have two Person/Group fields, "Owner" and "Secondary Owner" that are also the names of the controls. I have a Validation rule written as:

 

Rule.png

If both fields have the same name, the form validation will trigger:

 

Error.png

 

Thank you,

 

Sean Fiene


Sean - Thank you!  I was indeed using the Item Properties tab as opposed to the Named Controls tab to select the comparison fields, and that made all the difference.  Thanks for helping me out - I really appreciate it!


But wouldn't there be a problem, if two people would have the same display-name but different accounts, because the comparison is based on the display name?


I just tested this with two different accounts that have the same display name, and it evaluates correctly - meaning it does not fail the validation, so I believe it is actually comparing the underlying accounts and not the display name.  Thanks for the comment!


what if I want to compare the people field with the current user which is not in my named controls?!


Christine - In that case, you could make the comparison with Current User in the Common tab.  For example, if you didn't want the logged in user to be entered into a column called SecondaryOwner, you could write the validation formula:

equals(Current User,SecondaryOwner)

where Current User is from the Common tab and SecondaryOwner is from the Named Controls tab.  If it evaluates to true, then the Message will be presented.


Reply