If you want to create or update an item or a whole list in SharePoint or Dataverse you can use the patch function. For different column types you need different functions. In this post I will show you the difference between update and create and the code for every column type. For this I will use a list called “PatchOptions”.
You can use Patch to create a new item, to update a single item or you can use patch to update all items of a gallery
Create a new item

Update a new item

Update all items of a gallery

Different column types need different kinds of “patching”. Next I will show you the different column types.
Text Field

Choice Field
To patch a choice field you can use a dropdown and then you patch the selected item.

People Field
To patch a people field you can use 2 ways to update/create the field.
You can write out the patch or you can use a combobox to create a people picker where the displayField and searchField are equal to [“DisplayName”].


Date Field
To patch a Date field you can use a datePicker and then you patch the selected date.

Yes/No Field
To patch a boolean field you can use a toggle.

HyperLink Field
To patch a HyperLink field you can use a text and you can use a hint text to let people know what format you want link for example “https://www.site.com”.

Image Field
To patch a image field you can use a “Add Picture” and then you patch the inserted image.

Lookup Field
To patch a lookup field you can use a dropdown and populate it with items from the lookuplist.

Plaats een reactie