ProfileMenu page parameter

I've worked through the Create a complete application and trying to make a couple modifications.
I'm trying to modify the menu choice [Profile] in the PanelMenu to pass a page parameter to the edit-application-user page. It takes a parameter called Id, which is the user id.

It works if I hardcode the value into the attribute value field like this: ${'cfdaf003-7e56-429c-a711-4fa5ede03199'}

But if I do this: ${Security.User.Id}
I get an error: Error: Cannot match any routes. URL Segment: 'edit-application-user'

Can anyone tell me what is wrong?
Thanks, Dan

Really what I'm trying to do is duplicate the crm.radzen.com function of the Profile selection in the ProfileMenu.

How is the user taken to their profile when the Profile menu choice is selected?

The profile menu is defined in the Main layout page and simply navigates to the profile page. The profile page assumes the logged-in user. On the other hand the Edit user page requires a parameter Id that identifies the user. The Error: Cannot match any routes. URL Segment: 'edit-application-user' suggests the parameter is either missing or named differently. Make certain that if the page is called elsewhere the parameter names are identical.

I can't get it to work. It navigates to the profile page, but it opens up blank.
How does the Profile page assume the logged-in user? Doesn't there need to be some event defined to load the correct record?

The profile form load event calls ServerMethodsController.UserPersonalData



Check for server errors and that security is enabled. You can step thru the serverside code in visual studio.

OK, I follow that and it works now.
I'm trying to understand the process and what options are available throughout the system.

I thought I could just call the same methods as what's in the Edit Application User page passing in the Id parameter:

And the save it the same way:

Or some combination of that. Why doesn't that work?

The profile form is normally for the logged-in user to amend their own details. They must know their current password to change it.
The edit application user form is only used by the administrator to set up new users and amend users if needed.
The administrator can set/change a user's password but should not know what that users current password is set to.
The edit application user form is called from a list (grid) that passes the user Id to the edit form.

Right, I follow all that.
But, if I understand it correctly, the Main page load event calls the UserPersnalData function that returns the user data to the page. So, if I go into the ProfileMenu, which is on the same page, and edit the Items, select the Profile item, I can add a Parameter to the properties and it shows I have access to "userData" which is the data from UserPersonalData function. (I modified this function to return the user id as UserID.) So can I define it here the same way it's defined in the list (grid)? Seems like it should be availble and should pass it to the profile page the same way it's being passed from the list to the edit application user page.

Have not tried it but should work with profile menu. Did you add the parameter to the profile form and pass to the server method. The existing server method is more secure as client parameters can be tampered with.
You can check the parameter is passed using the JavaScript debugger.
Router issues can be difficult to trace and it is often easiest to check app.routes.ts and the calls in the individual page json files. Common problems to look out for are parameters that are missing, misspelled, orderered differently, and parameters added but never named

I had tried adding the parameter to the profile form and then passing the user id in from the profile menu, but couldn't get it to work. I was trying to do it via the Attributes, but in looking at that further, I think that is incorrect. Attributes are a different thing.

I think I need to study how to pass a parameter from one page to another.

I created a simple example with parameters and it worked ok. Are you using a proper login or the development admin/admin as some things might work differently using that?

I'm not using development admin/admin. I'm in the project I created following the Create a CRM application with Radzen.

Like I stated in my first post, if I hardcode the value into the parameters value field, it works:

So, how can I get the value dynamically?

The steps I used using the Radzen rentacar example and ,NET 3.1 are

image

This just adds a separate page profile 2 to test parameter passing.

That works for me too, even though I'm on .NET 5.0!

The trick seems to be in this code: ${security.user.profile.nameid}

So there evidently is a problem with getting the value from the property in the profile menu page. That does not seem to work, even though it seems like it should.
I don't know where you found that code, as it does not show up in any property that I found. If you look at the page properties or the security.user object, profile is not there:


Is there some documentation somewhere?

My final solution is to use that code in the profile page instead of passing it in. No need to pass it in, as it can be used directly in the parameter value of the page load properties:

Appreciate your help in getting this working!
Dan

Glad you got it to work.
I think it is documented somewhere but I can't find it anymore.
Perhaps @korchev can assist.

You can also inspect the properties in the browser javascript debugger