Execute CRUD operations within the Power Platform using a Canvas App

 

User story: When a new account is created, there is a requirement to execute a curd operation via Power Apps, involving updating an existing record and deleting the record from the accounts.

If we want to few complete records in accounts entity on welcome screen:

Navigate to vertical Gallery and select Items property should be Item=Accounts.


To create a new record, one must click on the plus icon displayed on the screen and input the formula provided below, as illustrated in the following screen. This action will prompt a new screen to open for the creation of the new record.

 

Navigate(CreateScreen);ResetForm('Account Create Form')

After navigating to the creation screen, a new form will be displayed, and it is necessary to configure the data source to 'Account,' as shown in the screen below.

And Items property = Defaults (Accounts)


Next, upon clicking the submit button, we should save the data in the account entity and return to the main screen.

We need to write below formula on Onselect property of button in app.

SubmitForm('Account Create Form');Navigate(GridScreen)


Next, on click on cancel button we need to navigate back main screen.

Write formula on OnSelect = Navigate(GridScreen).


When the edit icon is clicked, we should navigate to the edit screen, where the editing interface will open.

Add below formula on edit icon as show in blow screens and DataSource to Accounts

OnSelect = Select(Parent); Navigate(EditScreen, ScreenTransition.Cover, {})



On Item property set AccountGrid.Selected to open selected account will open in the edit form refer below screen.

OnSelect = SubmitForm('EditForm'), Navigate (GridScreen) When the save button is clicked, the account will be updated, and the user will be navigated back to the Main Screen.


OnSelect = Navigate(GridScreen) When the Cancel button is clicked, it will navigate back to the Home grid screen.



Next, if we wish to delete a record from the account entity, we need to apply the code below to the delete icon. This will result in the deletion of the corresponding selected record.

OnSelect = Select(Parent); Remove(Account, ThisItem);


Thank you...!


 


















Comments

Popular posts from this blog

How to implement approval in Teams using Adaptive Cards

Open canvas app with Customize the command bar using command designer

HTTP Request Methods

Create email templates in dynamic 365 and send email using Power Automate

Duplicate Detection in Dynamics 365 using power apps.