Patch is THE method for creating a record. It’s a magical method, because it also allows you to update information on the one hand, and target different data sources on the other.
Insert a recording
Patch can act on all kinds of data sources: SharePoint list, Dataverse table and collection.
Patch(
Books,
Defaults(Books),
{
DisplayName:"Marcel Proust",
Information:"20th-century writer"
}
)
Some explanations
The Patch method requires 3 parameters: Patch( DataSource, BaseRecord, ChangeRecord
Patch(Source, Recordset, Datas)
The source : Your SharePoint list, Your Collection or your Dataverse table?
Recordset : Use Default method to create a Blank Recordet
Datas : Fields and Data to Insert in the Recordset
Dans notre exemple, Directory est le nom de notre liste SharePoint, c’est notre Source
Default(Directory) signifie que nous souhaitons créer une nouvelle ligne dans la liste Directory. C’est notre Enregistrement
Le 3e paramètre spécifie pour chaque champ la valeur que nous souhaitons intégrer. Ce sont nos données