Search code examples
powerapps-canvasiconvertible

How to send data from forms -> gallery -> sharepoint?


I have a form application for ordering items, the data is then transferred once the user clicks add to cart by a collect function succesfully into screen 2's vertical gallery. Then I want to click submit and that would submit the entire shopping cart but nothing is getting submitted. The code for my "Submit" button is:

ForAll(
    Gallery6.AllItems,
    Patch(
        'E-Store',
        Defaults('E-Store'),
        {
            'User name': userName,
            'DOB': dateOfBirth,
            'Item name': itemName,
            ...
        }
    );
    
    
);
Clear(collection1);

I think the issue might be in the Defaults brackets, the left side is autocompleted and the right side I have tried to use directly from my sharepoint list's url in the column section and also from my gallery(the names of the items in the gallery. When I run it sometimes I get a IConvertible implentation error and sometiemes no error but in both times nothing is being sent to sharepoint. I have tried before with SubmitForm() but I want to be able to order mutliple items and then submit it all, one item per row.


Solution

  • So the answer to my issue was that I had to use "ThisRecord" instead of Gallery and also reference the items from my column names from sharepoint(the url).

    Examples:

    'User name': ThisRecord.userName,
    'Submition date': DateValue(subDate),
    'DOB': DateValue(DOB),
    ....