Hi I have an app with 2 forms that are identical. On one of the forms I need to change a dropdown so that it has a defualt value that is User().FullName, and to be hidden. Is this possible?
Solved! Go to Solution.
I HAVE SOLVED IT!!!!!!!!!!!!
in DefaultSelectedItems i put [Label10.Text} and it works.
i tried changing the text in the label to another employees name, and it changes the combobox.
Thanks for everyone's help.
Yes... so long as the User().FullName is in the Items for that dropdown.
The default property would be: User().FullName
The Visible property would be: false
But I wonder why you need the dropdown at all? If it is going to be invisible, you don't need the functionality. If you are feeding this form from the other (where the person is picked), you could just pass it as a context variable during your navigate() statement, or, if you really needed a control to hold the data, you could use a label.
Thanks I'll give this a try.
I am building an absence and attendance tool, similar to the template app. I have one form that the employee fills out (so i dont want them to be able to change the employee name), and one for a manager to complete (so they will need to select the employee). Both of these once completed get added to the same sharepoint list, so i need the fileds to be the same.
The fields can be the same, but the controls don't necessarily have to be, right? Especially if the control is going to be invisible and not allow changes. In that case, it is easier (and shorter code) to reference a label. Just a thought.
I have added a label to the screen with the text User().FullName. It is showing as my name.
In the default field for the employee name card i have entered Label9.Text. i get the formula error "The property sxpects Record values, but this rile produces incompatible Text values."
I think there is some confusion about what you are trying to accomplish. Here is what I understand about what you're trying to do. Correct me where I am mistaken.
You have 2 forms that are identical except for this one field.
One form will be accessed ONLY by managers.
The other form will be accessed only by NON-managers.
On the manager form, the Employee field should be editable (thus, a dropdown/combobox)
On the non-manager form, the Employee field should be non-editable (thus, a label)
When a manager accesses the manager form, s/he can pick any of the employees in the dropdown (maybe, or maybe not, limited to their direct reports).
When a non-manager access the employee form, s/he should see their own name already in the Employee field (label), and should NOT be able to change it.
So when we are talking about the default item for a dropdown, we are ONLY talking about a manager accessing the manager form. (In fact, if Label9 (from your image) is supposed to be the label representation on the non-manager form, then you're conflating the use-cases and over-complicating things.)
One more point of clarification: if, in this narrow case of a manager accessing the manager form, you want to default the dropdown to be User().FullName, you are necessarily talking about the User who is using the app at run-time. That means, for your testing, you will be returning your own name. It also means that the manager will have the dropdown defaulting to their own name.
If all of that is right, then we are making progress. That's the understanding on which I am basing my help. So, moving on...
The non-manager form is easy: give the label for the Employee field a Default of User().FullName.
For the manager form...
Your thread mentioned a Dropdown, but your image is of a Combobox. This is very important because the Default for a Dropdown can be a text string, but your combobox is going to expect a record, as your error suggests. To return a record, you're going to need to do a First(Filter()) construction to get the right record returned for the default. From your image, it looks like it might be:
First(Filter(Choices('Leave Requests RF'.'Employee Name'),'Employee Name' = User().FullName)))
Again, this will look for a match against the current user's FullName field, and return the appropriate record from your datasource.
Give that a try, and post back.
COMPLETELY UNREQUESTED SUGGESTION:
Not to complicate things, but if you get this working, let me suggest you take it a step further. If the only difference between the 2 forms is this one field, then you can simplify your app and get this down to a single form (making later updates/enhancements easier to manage). Go with the combobox solution as we have worked it out, above, and have everyone navigate to this same form. In the button that would navigate TO this form, put your logic that determines if the user is a manager or not (previously, you would have used this to steer people to the appropriate form). Send the true/false to the form we are working on as a context variable, and let the combobox reference it in the DisplayMode property.
Putting a fine point on it:
Button from previous form:
The orange part is what you would replace with your logic, provided that it returns a true/false type output. This could be checking a field (IsManager) in a record source (EmployeeList):
Employee combobox DisplayMode:
Doing this, everyone goes to the same form, and all of your edits are containted to this one thing. It also removes the combobox functionality (effectively disallowing changes) for non-managers, but preserves it for managers.
Try all of that and let us know.
(Or ask if something isn't entirely clear...)
The more I think about it, I would go the single form route.
Fix the combobox with the First(Filter()) construction, and set the DisplayMode appropriately (as described in the previous post).
That will save you a world of headaches, later.