cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kevingeorget
Level 8

Updating a text with the user name based on a global variable

Hi PowerApp Users,

i have a query.

I'm trying to update a text field with the current user name based on a global variable and a click button (the button submits the form as well).

On select event of the button- Set( varStatus, "CL");SubmitForm(SharePointForm1)

On the default value of the text field- If(varStatus = "CL",User().FullName, Parent.Default )

This doesn't update the field value.

But if i assign a label with the default value as User().FullName and then update the default value of text field to

If(varStatus = "CL",label1.text, Parent.Default ), it WORKS.

Can any one tell me why it has to be done this way. Just trying to understand the logic behind it.

Regards,

Kevin

2 REPLIES 2
TimRohr
Level 10

Re: Updating a text with the user name based on a global variable

I came here ready to point out that I've seen global variables do some funny things around Text inputs and to suggest a context variable, but I've mocked up a version of your situation and don't have a problem...

 

OnVisible for my screen:

Set(varStatus,"CK")

EditForm(Form1)

 

Default for Text1 in my Form:

If(varStatus="CL",User().FullName,Parent.Default)

 

OnSelect for my Button:

Set(varStatus,"CL");

SubmitForm(Form1)

 

That updates the Text1 input. Now, Text1 is not in my datasource, so I am not actually writing it anywhere, so I don't know if Text1 updates before the record is written to my datasource or not, but it does update.

 

What is different between that and what you have going on?

kevingeorget
Level 8

Re: Updating a text with the user name based on a global variable

Thanks for the reply @TimRohr .

That's strange...You've done the same steps that i followed. This works for me if I update the Text field with any literal value but not with a User fullname.

Wonder if this is just a one of issue for me only or not. 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (6,054)