rutica
Scholar

create a validation rule on a calculated field with a people picker

Jump to solution

I am using SharePoint 2013 and Nintex 2013. I have a Nintex form with a people picker field called ProjectLead.

 

Some users in the active directory have 2 entries for their UserID:  For example:

i:0#.w|ds\m12tbad

i:0#.w|ds\m12tb

 

I use the UserProfileLookup to fill in the Manager of the ProjectLead behind the scenes. The Manager field isn't visible on my form. The Manager field is saved to my list and I use that field to Group as a View on my list. 

 

If the user selects the first UserID (the one with 17 characters), the Manager won't fill in. 

If the user selects the second UserID (the one with 15 characters), the Manager works properly.

 

I was trying to put in a validation rule to say the ProjectLead control is invalid if:

equals(ProjectLead,17).  That didn't work. I tried equals({self},17). That didn't work. I tried ProjectLead==17. I tried ProjectLead=="17". I tried {Self}==17. I tried {Self}=="17". No luck.

 

So then I created a calculated field (Data Type=Generic) where the formula is: length(ProjectLead). When I look at that calculated field on my form and choose the first ID, I see 17.  Good!

So I tried to make a validation rule on that calculated field saying: Equal({self},17). But it doesn't work.

 

How can I check if the ProjectLead field has a value of 17 and display a message asking the user to select the other ID?

Thanks

Tags (1)
0 Kudos
Reply
3 Replies
rangelin
Scholar

Re: create a validation rule on a calculated field with a people picker

Jump to solution

Rutica,

You need to use the calculated control in your validation formula. First you need to name the calculated control, lets say you name it calcLength. Then in your validation rule formula you would put in calcLength < 17 because it is invalid if it is 17. The only other thing to not is that the validation rule does not apply until the user submits the form. If you need immediate validation you will have to use javascript.

 

I hope this helps,

Randy

0 Kudos
Reply
rutica
Scholar

Re: create a validation rule on a calculated field with a people picker

Jump to solution

Hi Randy

Thanks for writing. I tried your suggestion but no luck.

 

I named my calculated field LengthID. On my ProjectLead field, my rule is: greaterThan(LengthID,16).

 

You had written: "in your validation rule formula you would put in calcLength < 17 because it is invalid if it is 17. " But the rule states: "Control is invalid if...". My controls are invalid if it is 17.

 

I was in Nintex Form Design Preview mode and entered the people picker where the LengthID = 17 and hit Save, but the form just closed without my validation message appearing.

0 Kudos
Reply
rutica
Scholar

Re: create a validation rule on a calculated field with a people picker

Jump to solution

I figured it out. There was some java code that was stopping all validation rules from appearing! I removed the java script and the validation works.

 

This is what I used as the validation rule on the ProjectLead field:    equals(length({Self}),17)

 

Thanks!

0 Kudos
Reply