StratusForms icon indicating copy to clipboard operation
StratusForms copied to clipboard

Inconsistent results from StratusFormsAddUserToPeoplePicker()

Open plbowers opened this issue 4 years ago • 0 comments

When I use StratusFormsAddUserToPeoplePicker(<email address>) to add someone to a peoplepicker and then get it back using StratusFormsGetPeopleFromPeoplePicker(<id>) I get results that look like this:

AutoFillDisplayText: "<display name>"
AutoFillKey: "<email address>"
Description: "<email address>"
DisplayText: "<display name>"
EntityType: "User"
IsResolved: true
Resolved: true
__proto__: Object

When I use the UI to enter a user and select it and then get it back using StratusFormsGetPeopleFromPeoplePicker(<id>) I get results that look like this:

AutoFillDisplayText: "<Display Name>"
AutoFillKey: "i:0#.f|membership|<Email Address>"
AutoFillSubDisplayText: ""
AutoFillTitleText: "<Email Address>\nTenant\n<Email Address>"
Description: "<Email Address>"
DisplayText: "<Display Name>"
DomainText: "<domain prefix>.sharepoint.com"
EntityData:
    Department: ""
    Email: "<Email Address>"
    IsAltSecIdPresent: "False"
    MobilePhone: ""
    ObjectId: "<GUID>"
    Title: ""
__proto__: Object
EntityType: "User"
IsResolved: true
Key: "i:0#.f|membership|<Email Address>"
LocalSearchTerm: "<search term>"
MultipleMatches: []
ProviderDisplayName: "Tenant"
ProviderName: "Tenant"
Resolved: true
__proto__: Object

Note crucially the differing values in AutoFill* fields so those cannot be depended on and, most crucially, the absence of an EntityData object and the Key value when added via StratusFormsAddUserToPeoplePicker().

I am guessing that this works with StratusForms (i.e., a person added programmatically via StratusFormsAddUserToPeoplePicker() presumably gets updated when the form is saved) but it sure would be nice if this function could be used in a more generic sense. I am doing more than just setting and saving the value (I need to pass it elsewhere) and I'm coming up short on usable values in the object.

plbowers avatar Jul 07 '21 14:07 plbowers