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

Add new item to sharepoint list with refence fields.

Hello all,

 

i can't find the way how to collect() an ne item to a sharepoint list with a refenced collumn to another sharpoint list.

let me explain what i need:

We have a list for planing internal educations in our company. So the fist List called (Schulungsübersicht) has all the informations except the employees who can book the education by itselve. The second List called "Teilnehmer" has a reference field to the "Schulungsübersicht" Title, wich is the Name of the Education.

 

i've created a Powerapp to search and select an education. on the Detailscreen there are all the informations. so there should be one button "book education" to add an item to the "Teilnehmer" List with the Title Information from the selected education an add the name of the current User to the List.

So my code looks like this but it doesn't work:

Collect(
    Teilnehmer;
    {
        Schulung: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";
            ID: LookUp(
                Schulungsübersicht;
                Titel = DataCardValue12.Text;
                ID
            );
            Value: DataCardValue12.Text
        }
    };
    {
        Teilnehmer: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
            Claims: "i:0#.f|membership|" & Lower(User().Email);
            Department: "";
            DisplayName: User().FullName;
            Email: User().Email;
            JobTitle: ".";
            Picture: "."
        }
    }
)

the reference Field in "Teilnehmer" is Schulung and it references to the Titel field in "Schulungsübersicht".

 

any idea?

 

kind regards Alex

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Add new item to sharepoint list with refence fields.

Hi @zlex ,

Do you want to update lookup field?

ID is a read-only field, so you can't update it.

Try this formula:

Collect(
    Teilnehmer;
    {
        Schulung: 
            LookUp(
                Choices(Teilnehmer.Schulung);
                Value = DataCardValue12.Text
                  )
        '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
         Claims: "i:0#.f|membership|" & Lower(User().Email);
         Department: "";
         DisplayName: User().FullName;
         Email: User().Email;
         JobTitle: ".";
         Picture: "."
    }
)

Here's a doc about how to update lookup column for your reference:

https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/

 

 

Best regards,

Community Support Team _ Phoebe Liu

 

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

5 REPLIES 5
Highlighted
Frequent Visitor

Re: Add new item to sharepoint list with refence fields.

Hi,

I think I understand your question, it sounds like you are trying to populate referenced information using collected data, if that is the case, I will try and answer below. If not, ignore me!

 

From my experience, using collect with lookup columns is not currently working 100%. I have tried to do something simillar in the past, but for some reason, the returned values dont match up with the values being given by the lookup. Have to tried doing your lookup directly to the data source, if possible?

The last time, I was doing it so that I could allow the user to work offline, but had to abandon my efforts and make it online only, and then we worked around it from there.

Highlighted
Community Support
Community Support

Re: Add new item to sharepoint list with refence fields.

Hi @zlex ,

Do you want to update lookup field?

ID is a read-only field, so you can't update it.

Try this formula:

Collect(
    Teilnehmer;
    {
        Schulung: 
            LookUp(
                Choices(Teilnehmer.Schulung);
                Value = DataCardValue12.Text
                  )
        '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
         Claims: "i:0#.f|membership|" & Lower(User().Email);
         Department: "";
         DisplayName: User().FullName;
         Email: User().Email;
         JobTitle: ".";
         Picture: "."
    }
)

Here's a doc about how to update lookup column for your reference:

https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/

 

 

Best regards,

Community Support Team _ Phoebe Liu

 

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

Highlighted
Frequent Visitor

Re: Add new item to sharepoint list with refence fields.

Hello RabbyC,

 

thanks for your answer. i've testet the code from @v-yutliu-msft and this do the trick.

 

kind regards

Highlighted
Frequent Visitor

Re: Add new item to sharepoint list with refence fields.

Hello @v-yutliu-msft,

 

 

very thanks for your reply. Thats the solution and works fine.

to update the lookup field was one of the problem.

 

It saves me a lot of Time

 

Kind Regards

Alex

Highlighted
Frequent Visitor

Re: Add new item to sharepoint list with refence fields.

No Worries, glad you sorted it!

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,254)