cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Matt22365
Helper III
Helper III

Set "assigned to" when toggle turned on

Hi

I hope someone can help

I have an app which assigns a task, linked to a Sharepoint Task List, based on whether a toggle is turned on or not. I am having an issue with this feature as it does not always work correctly i.e. the person is not assigned in the linked task list

This is the formula i am using and it is in the "assigned to" default data card

 

If(Toggle5.Value=true,{DisplayName:Office365Users.UserProfile("Forename.Surname@company.com").DisplayName,claims: "i:0#.f|membership|"& Lower("Forename.Surname@company.com"),Department:"",Email:"Forename.Surname@company.com",JobTitle:"",Picture:""},ThisItem.'Assigned To')

 

Is there something I am doing wrong?

Matt 

2 REPLIES 2
RandyHayes
Super User
Super User

@Matt22365 

There are a lot of "parts" missing to describe your scenario completely, so I will make some assumptions.

The assumptions are that you have a DataCard that is for your Assigned To column and that in that datacard you have a combobox.  And, that your underlying column is defined as a single select person column.

 

If so, then your Default property for your DataCard should be : ThisItem.'Assigned To'

Your Items property for the combobox should be : Choices([@yourTaskList].'Assigned To')

Your DefaultSelectedItems property for your combobox should be:

Wiht({_user:Office365Users.UserProfileV2("Forename.Surname@company.com")},
    Coleasce(Parent.Default, 
        If(Toggle5.Value, 
           {DisplayName:_user.displayName,
            claims: "i:0#.f|membership|"& Lower(_user.mail),
            Department:"",
            Email:_user.mail,
            JobTitle:"",
            Picture:""
           }
        )
    )
)

Your Update property should be:  yourComboboxName.Selected

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi 

Thank you for getting back to me. Your assumptions are correct

I have made the changes you recommended, however I am getting an error in the DefaultSelectedItems:

"The function 'With' has some invalida arguments"

"Invocation of unknown or unsupported function"

 

Im not sure which part of the formula is causing this issue

Thanks

Matt

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,557)