问题
Sorry if this is too basic for this site, but app maker help directed me here. I am creating a data entry screen that includes basic info for a user - name, email, phone, etc. I am using the user picker to select the individual from our Directory. How do I pass all of the needed Directory field values of the selected user to my insert record screen. I am checking the valueisRecord box on the user picker, but can't figure out how to assign the selected user's info to the form's value fields. Thanks for the help.
回答1:
Ok, your last comment makes sense. But please, to avoid going back and forth, I encourage you to formultae your question properly by including all the information that could be required. Now, moving on to your problem...
The reason you are getting that error is because you are binding the UserPicker widget value to the datasource email field. Remember, the UserPicker value is an object, not a string.
To fix your problem, remove the binding of the value from the UserPicker. Then for the onValueChange change event of the UserPicker please add the following:
var fullName = newValue.FullName;
var email = newValue.PrimaryEmail;
widget.datasource.item.Name = fullName
widget.datasource.item.email = email;
That way, you don't assing an object to the email field but instead a plain string.
来源:https://stackoverflow.com/questions/58435535/user-picker-to-field-values