This project has moved. For the latest updates, please go here.

Conditional Visibility: Field (Branch Chief) matches (Current User)

Apr 17, 2015 at 6:46 PM
The conditional visibility seems to only work if you have members in a group. I have a field called Branch Chief which is selected by a user to submit a Help Desk ticket. I am going to use a workflow to send a notification to the Branch Chief to approve/disapprove. Is there a workaround to this? Thanks for your help in advance.
Coordinator
Apr 21, 2015 at 5:53 PM
Edited May 7, 2015 at 5:16 PM
First, I'm on vacation at the moment, so I'm not ignoring you; I'm just going to be a little slower responding than usual.

Anyway, If I understand correctly, what you need is the ability to create a rule based on the value of a people picker field, but in you're configuration you need to be able to specify a variable that will be replaced by the current user name at runtime, so you create a set of rules like:

Make the field Approve Editable where BranchChief Matches [CurentUser]
Hide the field Approve from Everyone

and at runtime, SPEasyForms should evaluate the rule as:

Make the field Approve Editable where BranchChief Matches DOM\mcsheaj
Hide the field Approve from Everyone

assuming DOM\mcsheaj is the user specified in the BranchChief field.. So if I am the current user, Approve will be editable, for everyone else it will be hidden.

If this is what you want, unfortunately SPEasyForms doesn't do this yet, but this would obviously be useful and I'd be happy to look into adding it when I get back.

Joe
Coordinator
May 7, 2015 at 5:27 PM
I've added this to AddOns v2014.01.18. You can specify [CurrentUser] in the value of a condition and it gets replaced with a regular expression at runtime suitable for checking if the current user is in a given user field.

Note that you must use Matches, not Equals. When you match against a user field, what you're actually matching against is some HTML, for instance:
<a href='/sites/SPEasyForms/speasyformssubsite/_layouts/userdisp.aspx?ID=12' target='_blank'>Scott Shearer</a>; <a href='/sites/SPEasyForms/speasyformssubsite/_layouts/userdisp.aspx?ID=9' target='_blank'>Joe Mcshea</a>
so the expansion expands [CurrentUser] to:
userdisp.aspx\?ID=9'
assuming the current usere's ID is 9. This is enough to ensure that the user is one of the users specified in the user field.

Joe
May 17, 2016 at 11:08 AM
Is it possible this issue has reoccured in the 2015.01.02 release? I was not able to get the condition to work when comparing a people picket field.
When debugging the JS, the field value was the anchor link from your post, but the value that SPEasyForms was generating was this:

"userdisp.aspx\?ID=1[[CurrentUser]]"

It does work for SP Groups

Kind regards,
Cameron
Coordinator
May 17, 2016 at 2:37 PM
I'll take a look at this as soon as I can and let you know what I find. I certainly didn't intentionally change anything in that functionality in v2015.01.02, but you never know and I don't think I specifically tested it in that release either.

Joe
Coordinator
May 17, 2016 at 4:31 PM
Edited May 17, 2016 at 4:50 PM
Also, what version of SharePoint are you on?
May 19, 2016 at 8:34 AM
Hi Joe,

SP 2013 here.

Thanks!
May 31, 2016 at 8:14 AM
Hello Joe,
same problem over here.
I'm using your very helpful solution for customizing wf-task forms.
But I have to make sure, only Assignee can submit their own task.
(I think, normally SP takes care of it OOB, but sacrificed this feature for the cool stuff of SP-Easy Forms :) )
So I first implemented a "highlight red" if "assigned to" matches [CurrentUser], just to verify functionality, but no red color for me :(
Using SharePoint Online aka O365
Best regards
Michael
Coordinator
Jun 6, 2016 at 8:27 PM
I'm still looking into this. I just got a tad busy. I'll let you know when I make some progress.

Joe
Coordinator
Jun 13, 2016 at 12:03 AM
If you get a chance, please try this download . It hasn't been regression tested much, but I wanted to get it out and see if it worked for you. Let me know.

Joe
Coordinator
Jun 25, 2016 at 8:53 PM
Added Issue 50 - Matches CurrentUser does not work in validation rules, fixed the issue, and released in 2015.01.03

Joe
Marked as answer by mcsheaj on 6/25/2016 at 1:53 PM