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

Need help with pushing user information to CDS on Checkbox click and removing date information when checkbox is unclicked

Here is my formula:


If(
Checkbox1.Value=true,
Patch('AtNeed Complete v2S', ThisItem, {'Task Completed - Sales Followup':"Yes", 'Task Completed - Sales Date':Today(), 'Task Completed - Sales Associate':User()}),
Patch('AtNeed Complete v2S', ThisItem, {'Task Completed - Sales Followup': "", 'Task Completed - Sales Date':"", 'Task Completed - Sales Associate':""})
)

 

 

Here is what I would like to do when a user clicks Checkbox1:


*Set CDS field 'Task Completed - Sales Followup' to Yes


*Set CDS field 'Task Completed - Sales Date' to Today


*Set CDS field 'Task Completed - Sales Associate' to the user that clicked the box.  

 


I can accomplish the first two, but cannot get the user recorded. 
I get the following three errors:

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'.


The function 'Patch' has some invalid arguments.


In CDS, the field 'Task Completed - Sales Associate' is set as a Data type of Lookup and Related entity of User.

 

 

Here is what I would like to when a user unclicks Checkbox1:


*Clear CDS field 'Task Completed - Sales Followup' 


*Clear CDS field 'Task Completed - Sales Date' 


*Clear CDS field 'Task Completed - Sales Associate' 


The only one of these tasks I've been successful with is the first.  

 

 

Can someone help me with entering the user information and clearing the date?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Need help with pushing user information to CDS on Checkbox click and removing date information when checkbox is unclicked

Hi @RStanley ,

Since lookup field is a complex data type, you need a little special formula to update it.

I suggest you try this formula:

Patch('AtNeed Complete v2S', ThisItem, {'Task Completed - Sales Followup':"Yes", 
'Task Completed - Sales Date':Today(),
'Task Completed - Sales Associate':
LookUp(Users,'Full Name'=User().FullName)})

Here's a  issue about how to update lookup data type of cds in powerapps for your reference:

https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/Patch-a-CDS-Lookup-column-within-Pow...

The second thing that you want to, I'm afraid it's not supported in PowerApps currently.

Because "" is text type, while the three columns that you want to update to blank are all not text type.

However, there's an alternative way to make this, please refer this issue:

https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/Update-blank-Null-value-to-fields-Da...

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Edwin-Abdalian
Level 10

Re: Need help with pushing user information to CDS on Checkbox click and removing date information when checkbox is unclicked

what is the type of the 'Task Completed - Sales Associate' field? is it a lookup field to the Users entity? also I noticed that you are setting that field to User(). the User() function returns a record and you can't patch it to a single column. Try using User().Email or User().FullName

Community Support Team
Community Support Team

Re: Need help with pushing user information to CDS on Checkbox click and removing date information when checkbox is unclicked

Hi @RStanley ,

Since lookup field is a complex data type, you need a little special formula to update it.

I suggest you try this formula:

Patch('AtNeed Complete v2S', ThisItem, {'Task Completed - Sales Followup':"Yes", 
'Task Completed - Sales Date':Today(),
'Task Completed - Sales Associate':
LookUp(Users,'Full Name'=User().FullName)})

Here's a  issue about how to update lookup data type of cds in powerapps for your reference:

https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/Patch-a-CDS-Lookup-column-within-Pow...

The second thing that you want to, I'm afraid it's not supported in PowerApps currently.

Because "" is text type, while the three columns that you want to update to blank are all not text type.

However, there's an alternative way to make this, please refer this issue:

https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/Update-blank-Null-value-to-fields-Da...

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

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 (5,593)