The RequestApproval action can be assigned directly to an email address but that permits approval/rejection only through the Lazy Approval feature. I'd like to allow my users to also be able to respond through SharePoint but for this I need to be able to retrieve the actual Person object from the UPS based on, say, the email address or the login name. I can get a Person's properties from the Query AD action but I cannot get the Person from the properties. Is there a way to do this within the workflow?
I tried defining a Person/Group workflow variable then using Set Variable based on one of its properties (it only allows to use Account Name but even that didn't work). Thanks in advance.
but I cannot get the Person from the properties
do you mean that you have user login name (in correct format) and you are not able to convert it into Person object in people or group variable?
If so, I've tested it once and it worked for me following way
- I created text variable and set it to login name (account name or other unique user identifiers should work as well)
- I created people or group variable and set it to text variable
- in flexi task I set assignees to people or group variable
Yes, that's exactly what I'm trying to do. In fact, I tried your method but it fails at the second step because I cannot set the person variable (approver') to the text variable ('username').
- I tried this when creating the approver variable by setting its default value but that didn't work
- I tried it using the Set Variable action (see image) but it always generates an error saying:
"Workflow failed to get user profile for user: bruce.altner"
Thanks for the reply.
Here's an update. I had pretty much given up on this but decided to try again after reading that you got it to work. This time I defined username to include the claims-based token (e.g., i:0#.w|<domain>\<username>) instead of just <username>. This time it worked!
However, what I'd really like to use is the email address (because I'm much more likely to have that information available for the approver than the fully-qualified login name). See image. That still doesn't work. In that case I get this error:
"Workflow failed to get user profile for user: <my email address>"
hm, that's strange.
I've retested the scenario with mail address in my env and it works without problem.
I even noticed that if in set variable action I provide as a value mail address and press 'check names' icon, it immediately recognized user account and change the value to user object
does that work for you?
do you by any chance get mail address followed by a comma or semicolon? or possibly space?
I've experienced cases when this caused problem to resolve user account.
No, I get an error:
No exact match was found. Click the item(s) that did not resolve for more options.
I get the same error if I use the username without the claims token. But if I use the fully-qualified username, it works.
I think that what might be happening is about non-uniqueness. When I click on the item, as suggested, it shows multiple matches because I have several accounts (this is a test environment that supports both Windows and Forms authentication) with that name or email address. It doesn't know which one to return. I will try adding these to a collection variable and then selecting a single one.
yeah, that's it.
I've thought of that as well, but since you've written you do back and forth lookup between account and properties I somehow assumed you work with unique identifiers.