cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dr_David_Banner
Helper I
Helper I

Set Assigned User to current user in CDS

Hi

 

I'm really new to PowerApps so please bare with me

 

I'm trying to update a field in the CDS with the current user - the idea is for the user to assign the item to themselves

 

I've created a label using the user().FullName function and called it "Userfullname" 

 

I have a custom field in the CDS called "Assigned To" and this is the command I am using so far (unsuccessfully)

 

Patch([@Alerts], ThisItem, {'Assigned To' : Userfullname})

 

can anyone help? 

 

thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Dr_David_Banner ,

Since the Assign To is a lookup field, you need to save a record of parent entity to that field. Please try this:

Patch([@Alerts], ThisItem, {'Assigned To' : LookUp(Users,'Full Name'=Userfullname.Text)})

Hope this helps.

Sik

View solution in original post

7 REPLIES 7
eka24
Super User III
Super User III

I guess the formula is inside a Gallery.

Use

Patch([@Alerts], ThisItem, {'Assigned To' : User(). FullName})

 

Or if a variable, OnStart of the App or Onvisible:

Set(Userfullname,User().FullName)

Then change your formula to:

Patch([@Alerts], ThisItem, {'Assigned To' : Userfullname})

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

 

thanks @eka24 

 

I appreciate your help with this

 

I have tried 

 

Patch([@Alerts], ThisItem, {'Assigned To' : User().Fullname})

 

the error I get is: 

 

The type of the argument "qrs_AssignedTo" does not match the expected type 'Record'. Found Type 'Text'

 

 

 

Use

Patch([@Alerts], ThisItem, {'Assigned To' : {Value:User().Fullname}})

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

thanks again, I now have another error message: 

 

invalid argument type. Expecting a Record Value, but of a different schema

missing column. Your formula is missing a column "Access Mode" with a type of 'OptionSetValue'

 

thanks

 

The custom field "Assigned to" in the CDS is a lookup field linked to the user entity BTW

Hi @Dr_David_Banner ,

Since the Assign To is a lookup field, you need to save a record of parent entity to that field. Please try this:

Patch([@Alerts], ThisItem, {'Assigned To' : LookUp(Users,'Full Name'=Userfullname.Text)})

Hope this helps.

Sik

View solution in original post

thanks, that is working perfectly, much appreciated 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (92,939)