Mục lục bài viết

Mẹo Hướng dẫn PowerApps connect two SharePoint lists Mới Nhất

Cập Nhật: 2021-12-11 02:39:10,You Cần kiến thức và kỹ năng về PowerApps connect two SharePoint lists. Bạn trọn vẹn có thể lại Thảo luận ở cuối bài để Mình được tương hỗ.

688

In Power Apps it is possible to have multiple SharePoint list forms on one lists custom form.

Tóm lược đại ý quan trọng trong bài

  • The SharePoint setup
  • Multiple SharePoint list form
  • Updating multiple datasources
  • Further Thoughts
  • Share this:

The SharePoint setup

Table of Contents

  • The SharePoint setup
  • Multiple SharePoint list form
  • Updating multiple datasources
  • OnSave
  • OnEdit
  • OnCancel
  • OnNew
  • OnView
  • Further Thoughts

I created two SharePoint lists. With a lot of imagination I called them list 1 and list 2.

When I create a new item in list 1 I want to create an new item in both lists. When I edit an item in list 1 I want to edit the items in both lists.

If you want to use this pattern in a normal canvas app that isnt a custom form then just add the forms as described in the Microsoft documentation about forms in Power Apps.

Multiple SharePoint list form

Using the Power apps menu option on list 1, I created a custom form with Power Apps that looks like this.

Multiple SharePoint list form

The Orange form is the one that writes to list 1 and the green form writes to list 2. The first form is added by Power apps, the second one I had to add to the same screen. With a bit of resizing of the app it isnt too difficult to do.

Now when I set the title of both forms to item 1 and hit the save button

Only the item in the first form is saved to list 1. List 2 is not updated. So even though I have Multiple SharePoint list form only one of them is really used.

My second form is also not reset back to empty values. We will need to do some work here to make it all work as expected. Multiple SharePoint list forms may not be that easy.

Updating multiple datasources

First of all you could consider other data update methods as I described in Patch, SubmitForm and Update. However this time I will just use the Submitform and other form operations.

First of all we need to have a look at a number of pieces of code in the form that will need to be updated.

The code that we need to consider is:

  • OnCancel
  • OnEdit
  • OnNew
  • OnSave
  • OnView

OnSave

The OnSave is by default set to:

SubmitForm(SharePointForm1)

To make sure that the item is saved to the second item I will need to update the onSave to tư vấn my additional form. This second form is called Form1

SubmitForm(SharePointForm1);
SubmitForm(Form1)

With this OnSave code the out of the box save button.

OnEdit

The OnEdit is set to

EditForm(SharePointForm1)

You might think that the following code would work, but

EditForm(SharePointForm1);
EditForm(Form1)

you will find only one item is being edited.

So I added the the Item for my green form

First(Filter(List2, Title = DataCardValue1.Text))

And now when I edit an item I get both items to appear. Ok, this example isnt very exciting and quite often you might have to use different fields to link the items in the separate lists.

Just make sure that you have a key field that you can match up in both lists.

Also as the lists may contain more items , you might need to consider setting your indexes on the list columns correctly as multiple SharePoint list forms will hit both lists.

But hey, we now have something that look like a relational Power app form!

OnCancel

The OnCancel is set to

ResetForm(SharePointForm1)

This will need to be updated to

ResetForm(SharePointForm1);
ResetForm(Form1)

OnNew

The OnEdit is set to

NewForm(SharePointForm1)

This will need to be updated to

NewForm(SharePointForm1);
NewForm(Form1)

OnView

The OnView is set to

ViewForm(SharePointForm1)

This will need to be updated to

ViewForm(SharePointForm1);
ViewForm(Form1)

Further Thoughts

When merging two lists into one I might consider most of the time to create a screen with many controls on it and then use the patch function instead of the forms.

However as a quick solution I could consider the multiple SharePoint list form approach as described in this post.

It doesnt suit all use cases but definitely some.

Share this:

  • Tweet
  • WhatsApp
  • E-Mail

Like this:

Like Loading…

Related

đoạn Clip hướng dẫn Chia Sẻ Link Down PowerApps connect two SharePoint lists ?

– Một số Keyword tìm kiếm nhiều : ” đoạn Clip hướng dẫn PowerApps connect two SharePoint lists tiên tiến và phát triển nhất , Chia Sẻ Link Cập nhật PowerApps connect two SharePoint lists “.

Giải đáp vướng mắc về PowerApps connect two SharePoint lists

Bạn trọn vẹn có thể để lại phản hồi nếu gặp yếu tố chưa hiểu nghen.
#PowerApps #connect #SharePoint #lists