cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
broomj
Frequent Visitor

SharePoint: Updating a secondary data source while using the first data source as a static list of tasks.

I'm sure this question has been asked before, but I'm struggling to word my search queries in such a way as to retrieve the information I'm looking for.

 

Basically, I'm trying to create a PowerApp that has a static list of tasks a user must perform. This will then lead the user to enter a completion date against that task (which I will call an activity from the point forward), which will then be stored in a SP list. The lists look as follows:


Tasks:

ID (Auto generated SP ID)

Title (Single line of text)

Description (Multiple lines of text)

 

Example data:

IDTitleDescription
1Turn on PCMust be turned on to work!
2Open BrowserFor internet access.
3Open your EmailsMake sure all emails have been read.

 

This list may be updated in the future with new tasks, but can mostly be considered static and will only be updated from within the SP List itself, not through the PowerApp.


Activities:

TaskID (Matches ID in the Task List)

Name (Person or People)

Completed (Date)

 

Example Data:

TaskIDNameCompleted
1John Smith01/01/2020
2John Smith02/01/2020
1Jane Doe05/01/2020
1Jack Johnson08/01/2020

Ideally, I'd like to display the static task list as a gallery on a screen, then have a "Completed" date picker for each task in the gallery, then use some logic to grab the ID of the Task from the gallery to enter into the Activity item, and then use the currently logged in User as the Name.

 

So the Task list is purely visual for the user, and is read only within the PowerApp. Its purpose is just to prompt the user to enter a completed date for that task, which when they hit save, will save that completed date into a separate list, with an ID linking back to the task they set the completed date. I have had a play with galleries inside galleries and the like but none of it is quite doing what I want it to.

 

I'm hoping there's a way to do this using bound data sources so I don't have to manage the new/edit procedures myself, but I'm struggling to work out the best way to set up the form to get what I need. 

 

Any help would be greatly appreciated, thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

@broomj 

Do you mean you want to create a new record of Activities when user selects the task and completed date?

Does the Save button locate inside the gallery, right?

To patch a LookUp field of SharePoint,  you have to patch a record containing '@odata.type', Id and Value.

To patch a person column of SharePoint, you have to patch a record which contains "Claims", "Department", "DisplayName", "Email", "JobTitle", "Picture" columns. 

Please put this code to OnSelect property of Save button:

 

 

Patch(Activities,
Defaults(Activities),
{TaskID:
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: ThisItem.ID
Value: ThisItem.ID
},
Name:
{
Claims:"i:0#.f|membership|" & User().Email,
Department:"",
DisplayName: "",
Email: "",
JobTitle:"",
Picture:""
},
Completed:
DatePicker1.SelectedDate
})

 

 

 Sik

View solution in original post

2 REPLIES 2
v-siky-msft
Community Support
Community Support

@broomj 

Do you mean you want to create a new record of Activities when user selects the task and completed date?

Does the Save button locate inside the gallery, right?

To patch a LookUp field of SharePoint,  you have to patch a record containing '@odata.type', Id and Value.

To patch a person column of SharePoint, you have to patch a record which contains "Claims", "Department", "DisplayName", "Email", "JobTitle", "Picture" columns. 

Please put this code to OnSelect property of Save button:

 

 

Patch(Activities,
Defaults(Activities),
{TaskID:
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: ThisItem.ID
Value: ThisItem.ID
},
Name:
{
Claims:"i:0#.f|membership|" & User().Email,
Department:"",
DisplayName: "",
Email: "",
JobTitle:"",
Picture:""
},
Completed:
DatePicker1.SelectedDate
})

 

 

 Sik

This is exactly what I was looking for, I knew it would be something simple but I couldn't see the woods for the trees.

 

Thank you very much!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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