I am trying to create code that will update and be re used to update the record in power apps. But now the problem I have it updates the last record created on the list instead of creating a new record. Below is my code:
<code> If(
IsBlank(BrowseGallery1.Selected.ID),
Patch(
'MyList',
Defaults('MyList'),
EditForm1.Updates,
EditForm1_3.Updates
),
Patch(
'MyList',
LookUp('MyList', ID = BrowseGallery1.Selected.ID),
EditForm1.Updates,
EditForm1_3.Updates
)
);
Refresh('MyList');
ResetForm(EditForm1);
ResetForm(EditForm1_3);
Notify(
If(
IsBlank(BrowseGallery1.Selected.ID),
"Created Successfully",
"Successfully"
),
NotificationType.Information
);
Navigate(
HomePage,
ScreenTransition.Cover
);
</code>
<code> If(
IsBlank(BrowseGallery1.Selected.ID),
Patch(
'MyList',
Defaults('MyList'),
EditForm1.Updates,
EditForm1_3.Updates
),
Patch(
'MyList',
LookUp('MyList', ID = BrowseGallery1.Selected.ID),
EditForm1.Updates,
EditForm1_3.Updates
)
);
Refresh('MyList');
ResetForm(EditForm1);
ResetForm(EditForm1_3);
Notify(
If(
IsBlank(BrowseGallery1.Selected.ID),
"Created Successfully",
"Successfully"
),
NotificationType.Information
);
Navigate(
HomePage,
ScreenTransition.Cover
);
</code>
If(
IsBlank(BrowseGallery1.Selected.ID),
Patch(
'MyList',
Defaults('MyList'),
EditForm1.Updates,
EditForm1_3.Updates
),
Patch(
'MyList',
LookUp('MyList', ID = BrowseGallery1.Selected.ID),
EditForm1.Updates,
EditForm1_3.Updates
)
);
Refresh('MyList');
ResetForm(EditForm1);
ResetForm(EditForm1_3);
Notify(
If(
IsBlank(BrowseGallery1.Selected.ID),
"Created Successfully",
"Successfully"
),
NotificationType.Information
);
Navigate(
HomePage,
ScreenTransition.Cover
);