web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Default user in a textbox
Power Apps
Unanswered

Default user in a textbox

(0) ShareShare
ReportReport
Posted on by 18

Hi all,

 

I've set a default value in a textbox as follows:

 

Office365Users.MyProfile().Mail

 

This works, however, what I want to do is ensure that once this value is set it can never change (for example, if someone logs an issue I want the "Ticket Logged By" value to always default to the original user.

 

I tried:

 

If(SharePointForm1.Mode = FormMode.New, Office365Users.MyProfile().Mail, Parent.Default)

 

This is giving the following error message in the default value of the textbox "Invalid argument type (Record). Expecting a text value instead".

 

Can someone please point me in the right direction?

 

I'm also seeing an "Expected record value" error on the datacard update property (which is currently set as txtLoggedBy.Text). What should the update property be set with please?

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    A textbox has multiple display modes. In 'Edit' mode the text in the textbox can be edited. If you change the display mode to 'View' then the text is only viewable and can't be changed. So rather than trying to fix the value, adapt the display mode.

     

    You can change the property DisplayMode so that once the form has been submitted then the display mode changes. If the field is part of a form you can use either of  

    NewForm(SharePointForm1);
    ViewForm(SharePointForm1);

    to change the forms view mode and then link your text field's DisplayMode property to the form through

    SharePointForm1.DisplayMode

     

    The result is that your TextInput1.DisplayMode will always be the same as that of the SharePointForm1.

     

    You could also make this dependent on whether the data field is blank or not and only have it editable if the underlying data field is blank.

     

    Hope this helps 🙂

  • CFC1888 Profile Picture
    18 on at

    Thanks @Anonymous , that's useful information for future projects, but in this case it won't work as I don't plan on making the field editable at any time (I want the user name to auto-populate the textbox when the ticket is created, but once created this value should never change).

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi CFC1888,

     

    Then you can continue to use a text field and just make the DisplayMode to be 'View' and it will not be editable. Or you can use a label instead of a text field, here the DisplayMode won't matter cause a label is never editable. Both will work.

     

     

  • CFC1888 Profile Picture
    18 on at

    Thanks, however, we're back at the original problem though. I can set the textbox DisplayMode to View, but the issue I'm having is trying to get it to display the original user who created the record.

     

    Office365Users.MyProfile().Mail

     

    works correctly, but if someone else opens that same record the textbox will be populated with that person's email address. If I try:

     

    If(SharePointForm1.Mode = FormMode.New, Office365Users.MyProfile().Mail, Parent.Default)

     

    I get "Invalid argument type [Record]. Expecting a text value instead" on the default property.

     

    The Update property on the datacard is set as:

     

    txtLoggedBy.Text

     

    but that's giving me "Expected Record value".

     

    Sorry, this is my first time using PowerApps so I'm very much a beginner!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Ah, so the issue is more around saving and loading the data. Right?

     

    You will need to store the data into a collection and then point the text field to load the text from that collection. If the record is new you can populate the username using either of

    User().Email
    Office365Users.MyProfile().Mail

     

    If the record already exists then you will need to load the data from your data source into the collection, from where the the text field will then load the data (same as above). You can then allow/prevent the user editing some fields using the DisplayMode as above.

     

    If you're new to powerapps the easiest way to start is to use one of the sample apps and then modify that to suit. Have a look at 'Service Desk' or 'Leave Request', they may be close to what you're trying to build.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard