cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
TorreyFalconer
Level: Powered On

Auto-fill field with 'Created by'

Hello there, 

 

I just need some help with how to auto-fill a field. 

I have a Sharepoint list which contains a "Reported by" column, in my app, I'd like it to work so when people start a new form, that "Reported by" column auto-fills with whoever is filling out the form, so with the "Created by" info. I tried doing this by going to the default property and trying "This item. 'Created by'" in my Reported by field, but it isn't accepting the value. Help would be appreciated, thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Auto-fill field with 'Created by'

Hi @TorreyFalconer 

 

You are using the title field, which is a single line of text field

 

If(
    formname.Mode = FormMode.New,
   User().Email,
    ThisItem.Title)

View solution in original post

9 REPLIES 9
Super User
Super User

Re: Auto-fill field with 'Created by'

Hi @TorreyFalconer 

 

For the default property of the data card use,

If(
    formname.Mode = FormMode.New,
    {
        DisplayName: User().FullName,
        Claims: "i:0#.f|membership|" & User().Email
    },
    ThisItem.ReportedBy)

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

TorreyFalconer
Level: Powered On

Re: Auto-fill field with 'Created by'

@RezaDorraniI have done so on the default value of the data card and it says it is an invalid argument type. Is there anything else I should be adding? 

 

Annotation 2019-09-16 110324.png

 

 

Super User
Super User

Re: Auto-fill field with 'Created by'

Hi @TorreyFalconer 

 

formname should be replaced with your form control name

reportedby should be replaced with the reported by field referance in your app

 

I just gave an example

 

TorreyFalconer
Level: Powered On

Re: Auto-fill field with 'Created by'

@RezaDorranithanks, still a no go:

 

Annotation 2019-09-16 112616.png

Super User
Super User

Re: Auto-fill field with 'Created by'

Hi @TorreyFalconer 

 

I just tested this and it works fine

 

are you applying this on the data card or the control?

what is the type of field for this data card?

 

share screen shot of data card along with column type showcasing where this formula is used

TorreyFalconer
Level: Powered On

Re: Auto-fill field with 'Created by'

Super User
Super User

Re: Auto-fill field with 'Created by'

Hi @TorreyFalconer 

 

You are using the title field, which is a single line of text field

 

If(
    formname.Mode = FormMode.New,
   User().Email,
    ThisItem.Title)

View solution in original post

TorreyFalconer
Level: Powered On

Re: Auto-fill field with 'Created by'

Almost there! I thought maybe that had something to do with it, I renamed the title field "Reported by".

One more thing: the email of the user is showing up, is there any way for that just to be the name?

 

 

Super User
Super User

Re: Auto-fill field with 'Created by'

Hi @TorreyFalconer 

 

replace User().Email with User().FullName

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 276 members 3,223 guests
Please welcome our newest community members: