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

Unable to successfully create new items in SharePoint list from a collection

For the OnStart of the home screen, i have ClearCollect(colOrders, Orders List); Clear(colOrders).

 

The application displays items on in a gallery on that screen from a different list.  When the user selects an item to be ordered, the OnSelect does a Collect(colOrders, {Title:title_field.value, etc.}) setting various fields as text, numbers, dates and lookup/choice fields.  Along the way, colOrders has correct entries and values.

 

When the user finishes selecting items, the user can navigate to a cart screen which correctly displays the items ordered.  there is a submit button which has for OnSelect Collect('Orders List',)Defaults,colOrders); Clear(colOrders)  This executes only for the briefest of moments and then the gallery shows empty, but there are no records added to the Orders List.

 

I have tried Patch('Orders List',(Defaults(colOrders)) but i get an error on the expression that Title is required.  I also tried a ForALL with the Patch but still get Title field required error on the expression.  Title shows in the collection col Orders and has a specific value set each time an item is added to the collection.  I am not sure in the Patch expression how to get Title values to explicitly add since it is a table.

 

I could really use some help on this.  Forum comments are all over the place and documentation is sparsely written.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Unable to successfully create new items in SharePoint list from a collection

you Patch function would look something like this:

 

 

ForAll(
    colOrders,
    Patch(
        'Orders List',
        Defaults('Orders List'),
        { Title:Title , FieldName2:FieldName2 , FieldName3:FieldName3}
    )
)

 

Since it sounds like all the column names in the collection match the column names in the SharePoint list then the field and value pair will be the same for each field you want to update. (example Title:Title)

 

2 REPLIES 2
Super User
Super User

Re: Unable to successfully create new items in SharePoint list from a collection

you Patch function would look something like this:

 

 

ForAll(
    colOrders,
    Patch(
        'Orders List',
        Defaults('Orders List'),
        { Title:Title , FieldName2:FieldName2 , FieldName3:FieldName3}
    )
)

 

Since it sounds like all the column names in the collection match the column names in the SharePoint list then the field and value pair will be the same for each field you want to update. (example Title:Title)

 

Re: Unable to successfully create new items in SharePoint list from a collection

already sorted this out, but have new issues now!