web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issues with Param("ID"...
Power Apps
Unanswered

Issues with Param("ID") and EditForm

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

In order for users to get directly to a specific item, I've enabled deep linking via the BrowseScreen1 OnStart property:

 

If(
 !IsBlank(Param("ID")),
 Set(
 TargetRequest,
 LookUp(
 'Onboarding Requests',
 ID = Value(Param("ID"))
 )
 );
 Navigate(
 DetailScreen1,
 Fade
 ),
 Set(
 TargetRequest,
 RequestGallery.Selected
 )
)

using TargetRequest as the item property in both the DisplayForm1 and EditForm1.

 

This works fine in all aspects, except for the following

On the EditForm there is a button with its OnSelect property as follows:

Patch(
 'Onboarding Requests',
 TargetRequest,
 {
 Coordinator: {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims: "i:0#.f|membership|" & Lower(User().Email),
 Department: "",
 DisplayName: User().Email,
 Email: User().Email,
 JobTitle: ".",
 Picture: "."
 }
 },
 {
 Status: {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
 ID: 2,
 Value: "Ready to Send to Resource"
 }
 },
 {statusSearchString: "Ready to Send to Resource"}
);
UpdateContext({showPopup: false});
ResetForm(EditForm1);
Refresh('Onboarding Requests')

If I select an item from the RequestGallery and edit it , this works fine. It patches the record, the popup goes away and the Coordinator and Status fields show the patched values.

When I use the ?ID=nnn parameter in the URL (which brings me directly to the item in the DisplayForm) and then edit it, it doesn't work properly. It still patches the item correctly, but the fields won't show the new, patched values. If I go back to the gallery I can however see that the patching went fine. What could be the missing point here?

Categories:
  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    The patch function seems to have a little problem.

     

    Please take a try to modify it as below:

    Patch(
     'Onboarding Requests',
     TargetRequest,
     {
     Coordinator: {
     Claims: "i:0#.f|membership|" & Lower(User().Email),
     Department: "",
     DisplayName: User().DisplayName,
     Email: User().Email,
     JobTitle: ".",
     Picture: "."
     },
     Status: {
     ID: 2,
     Value: "Ready to Send to Resource"
     },
     statusSearchString: "Ready to Send to Resource"
     }
    );
    UpdateContext({showPopup: false});
    ResetForm(EditForm1);
    Refresh('Onboarding Requests')

    See if this would make any difference.

    The patch () function third part would have the following working order:

    "

    • ChangeRecord(s) – Required. One or more records that contain properties to modify in the BaseRecord. Change records are processed in order from the beginning of the argument list to the end, with later property values overriding earlier ones.

    "

    Person or group field and the choice field record schema has updated, just use the information in the example above should make it work.

     

    Regards,

    Michael

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-micsh-msftdo you mean the '@odata.type' declaration is no longer required although the Coordinator field is a Person or Group column and the Status is a Choice column in the underlying SharePoint list?

    As a matter of fact, the Patch works fine in both scenarios (navigating to and editing the item via BrowseGallery and DisplayForm or navigating directly with ?ID=nnn parameter in the URL), it's only that when using the ID Parameter, after performing the patch, the Coordinator and Status fields are not refreshed in the EditForm. When going via the BrowseGallery, they show the new, correctly patched values.

     

  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    THe attribute is required, but has been "hard-coded", so users no longer need to input this attribute.

     

    "

     after performing the patch, the Coordinator and Status fields are not refreshed in the EditForm.

    "

    If you are using patch with the EidtForm, and would like to have the form to display the updated record, you should collect the Patch() result and then use it under the Form Item property, and switch the form mode to Edit.

     

    Using SubmitForm () function, the Form control would be switched into Edit mode after the submit finished successfully.

    For more information about how the form works, see:

    Form in PowerApps

     

    Regards,

    Michael

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Michael thanks but why does it refresh properly as long as I have no Param("ID") defined? What is driving that difference in behaviour?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-micsh-msftHi Michael, I think I have found something that could be the culprit. I've added a debug label where I monitor the 3 values of Param("ID"), RequestGallery.Selected.ID and TargetRequest.ID.

    When going to edit the record via Param("ID"), the Gallery.Selected.ID is either blank or the ID of the first or the last item in the Gallery, depending on sort order, i.e. TargetRequest and Gallery.Selected are not the same, and that seems to make the EditForm refresh fail. However, I'm not using Gallery.Selected anywhere, item is always TargetRequest, which is always either equal to Param("ID")  when Param is present, or equal to Gallery.Selected when Param is not there. What is the point I'm missing?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard