How to create records in CDS from canvas app using PATCH function
- Sai Krishna
- Aug 4, 2020
- 1 min read
We can create records in CDS (for that matter any Data Source) from canvas app Using a PATCH function
Now let us se how can we create a record Using a PATCH function
there are two ways that we can make use of PATCH function to create a record.
Multi Form
using controls to create a record
Multi Form
suppose if we want to show some data as sectional information (to let the user fill up the form in sections) we can use this Multi Forms.
scenario: if we have a data source called "Students", which has around 10 fields to create a single student entry. We wanted to show up a form (frmStudentGenInfo) as one section called "General Information" and another form (frmStudentContactInfo) as a section called "Contact Information"
Now to create a record on a button click use this below snippet
PATCH(Students, frmStudentGenInfo.Updates,frmStudentContactInfo.Updates)using OOB controls to create a record
Scenario: if we planned to create our own UI (since we cannot customize a FORM control layout) with OOB controls to create a record in the back-end we can go with this PATCH control
Patch(
Students,
Defaults(Students),
{studentName: "Power Assist", email: powerassit@gmail.com}
)


Refer this to check out how to create a record using a FORM Control



Comments