hey all , 

I have a problem in my table that what I want to show only tickets that created by the same employee  how can I get employee ID to make this preparation ? 

Thank you .

Is the EmployeeID linked to the UserID? If so you can use the function GetUserId() to get the User.ID of the logged in user and from that pick up the Employee ID.

not isn't how can I link it ? this picture to more explain what I want, I want john see only tickets that he made it.


Hi Yousef, 

As Mattias told, the function GetUserId will return the Id of the logged user. 

Now, in the preparation of the page, you probably has an aggregate that is fetching the data and is being used as the source for your table in the screen. 

In this aggregate you need to add a Filter, to select only the records associated with this user. 

For example, if the entity is called MyEntity record has a field UserId (of type User Identifier), you can add a filter like this:

MyEntity.UserId = GetUserId() 

This will make only the records where the UserId is the same as the Id of the user that is logged will be returned. 

This is showed in the Online Training, so I recommend you revisit the training to remember those types of things. 

Cheers

Thanks for response . 

but I've an entity called "employee"  how to make this employee to login in and be the user ? how to make userID = employee id ? 


Hi Yousef, 

As Mattias told, the function GetUserId will return the Id of the logged user. 

Now, in the preparation of the page, you probably has an aggregate that is fetching the data and is being used as the source for your table in the screen. 

In this aggregate you need to add a Filter, to select only the records associated with this user. 

For example, if the entity is called MyEntity record has a field UserId (of type User Identifier), you can add a filter like this:

MyEntity.UserId = GetUserId() 

This will make only the records where the UserId is the same as the Id of the user that is logged will be returned. 

This is showed in the Online Training, so I recommend you revisit the training to remember those types of things. 

Cheers



Hello Yousef, 

Two questions for you. 

1. Did you finish the online training already? If not, please, finish it, as it will teach a lot of concepts you seems to ignore at this point. 

2. What do you mean by "how to make userID = employee id ?" 

This does not make much sense for me. 

There is a system entity called User that holds all application users. Every row in this User entity is a different application user, and the user Identifier is the attribute Id of the User entity. This entity also holds the password of the user, so, when the user logins, the password is compared to this one and if there is a match, the login is granted. 

From now on, the GetUserId function will return the Id of the logged user. 

So, why are you asking for how to login with this employee entity? You can create users using the User application. No need to create another entity for this.

I already finished developing web application .

I mean for example if we have a employee his name is Yousef and Yousef delivered ticket to engineering so only Yousef can see his ticket if we got another employees they can't see his .. I hope you understand me now .

and sorry for my stupid questions because I'm new here . 


Thank you a lot . 

Hello Yousef, 

Two questions for you. 

1. Did you finish the online training already? If not, please, finish it, as it will teach a lot of concepts you seems to ignore at this point. 

2. What do you mean by "how to make userID = employee id ?" 

This does not make much sense for me. 

There is a system entity called User that holds all application users. Every row in this User entity is a different application user, and the user Identifier is the attribute Id of the User entity. This entity also holds the password of the user, so, when the user logins, the password is compared to this one and if there is a match, the login is granted. 

From now on, the GetUserId function will return the Id of the logged user. 

So, why are you asking for how to login with this employee entity? You can create users using the User application. No need to create another entity for this.



Solution

Hello Yousef, 

No problem with question, but we understood you the first time and the answer I gave to you in my first comment. 

When your user creates your "ticket", the record you save must have the associated ID of the user that created it. So, the entity must have an UserId attribute that you set to the value of GetUserId function return value, assuming the user is logged in when creating the record (ticket). 

Without this information is not possible to filter the records to show only the ones created by the logged in user. 

And the way to show only the records an user has created, when they are logged in, is through a filter in the aggregate that fetches the data. So, the filter compares the UserId stored on each record with the UserId returned by the GetUserId function and only the rows where this info matches will be returned.

Solution

Thank you a lot I seems understand I appreciate your help .

Nice. You're welcome :)