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

Patcher une collection avec une clé étrangère sur Power apps

Hello everyone,

I have encountered a problem for 02 days. I'm also trying to patch a collection with a foreign key;

My code:

 

 

If(
    !IsBlank(DataCardValue128),
     If(
        Form6.Mode = FormMode.New,
        ForAll(
            DemandeAchatActifCollection,
            Patch(
                DemandeAchatActif,
                Defaults(DemandeAchatActif),
                {
                    ActifId:ActifCollection,

                    DemandeAchatId:
                    {
                        Id: Form1_10.LastSubmit.DemandeAchatId,
                        Value:Form1_10.LastSubmit.Code
                    }
                }
            )
        )
    );
    SubmitForm(Form6)
);

 

 

My error is found in this line: "ActifId: ActifCollection"

 

In principle I have a List that I named ActivePurchaseRequest, containing the identifier of the asset and the identifier of the purchase request; Subsequently I have a collection called RequestPurchaseActifCollection which allows me to load the Assets selected by a user during a purchase request (which works perfectly); the big challenge that arises now is that I have to save "RequestPurchaseActifCollection" in my sharepoint list ("ActifId: ActifCollection")

 

Thank you for your help !

34 REPLIES 34
PG_WorXz10
Resident Rockstar
Resident Rockstar

Hi @Hardy299 ,

 

What is the error message your getting on line with 

ActifCollection

 

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

Error Message

The type of this argument 'ActifId' doest not match the expected type 'Record' . Found type text.

 

My collection : 

Collect(DemandeAchatActifCollection, {ActifCollection:DataCardValue128.Selected.Value})

Hi @Hardy299 

 

What is the data type of ActifId ?

 

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

ActifId is a Lookup type field and it points to the name of the asset in my Sharepoint list

 

Hardy299_0-1629280325271.png

 

Hardy299
Helper III
Helper III

Hardy299_0-1629280997608.png

My collection (Gallerie

@PG_WorXz10 

ActifId est un champ de type Lookup et il pointe vers le nom de l'actif dans ma liste Sharepoint

Hi @Hardy299 ,

 

For Lookup fields below code needs to be used. 

ActifId: {
                    '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";
                    Id: ActifCollection.Id;
                    Value: ActifCollection.YourValueField
            }

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

Hi @PG_WorXz10 ,

Value: ActifCollection.YourValueField

on the line above, what does "YourValueField" represent please?

 

 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";

On this other line that represents '@odata.type' ? 

 

#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference" :is this the link to my SP list?

 

Please thank you

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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