cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jasirqadri123
Helper I
Helper I

Current Logged Records of User

Hi Everyone,

 

I have created log in page where i put user id and password to log in my application.

on logging in my app, only current logged in user id should view his only records.

 

On Log in button formula used:

 

jasirqadri123_0-1653324794529.png

 

 

If(!IsBlank(LookUp(Employees,'Personnel number'=TextInput1_1.Text)),Set(varAuthenticator,LookUp(Employees,'Personnel number'=TextInput1_1.Text)));If(TextInput6_1.Text = varAuthenticator.Password && TextInput1_1.Text = varAuthenticator.'Personnel number',Navigate('Repair Order Details screen_2',ScreenTransition.Fade,{'Personnel Number':"Technician"+Set(varsite,LookUp(Employees,'Personnel number'=TextInput1_1.Text))}),
Notify("Invalid username or password",NotificationType.Error));
Reset(TextInput1_1);
Reset(TextInput6_1);
Set(showLabel,true);

 

What logic should I put on login button that only Employees table where user id of employees should give only current logged records.

 

Employees used from D365 .

5 REPLIES 5
BCBuizer
Super User
Super User

Hi @jasirqadri123 ,

 

I think you have already all you can do on the Login button by passing a context variable with the personnel ID to the 'Repair Order Details screen_2'. At that screen you'll have to set up some filtering that uses that context variable.



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.
jasirqadri123
Helper I
Helper I

What is the formula please or code to insert on log in and on Repair Order Details screen_2 also

BCBuizer
Super User
Super User

Hi @jasirqadri123 ,

 

As mentioned I don't think you need to do anything on the LogIn screen. Since I don't have any details on Details screen_2 or your data source I really can't tell anything more detailed, so please share:

 

What controls are you using on Details screen_2 to display order information?

How are orders linked to employees in your data source?

 

A screenshot of Repair Orders Details screen_2 will help as well.



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.
jasirqadri123
Helper I
Helper I

Gallery I am using where on items I have put this formula,

SortByColumns(If(sortAll,Filter(RepairOrderTables,WarrantyStatus = Dropdown.Selected.Value && Site = varsite.Site && (If(techAll,Technician = Dropdown1_1.SelectedText.Value,Site = varsite.Site))),Filter(RepairOrderTables,Site = varsite.Site && (If(techAll,Technician = Dropdown1.SelectedText.Value,Site = varsite.Site,If(!IsBlank(DatePickerStart.SelectedDate) && DatePickerStart.SelectedDate <= DatePicker.SelectedDate,RepairOrderDate <= DatePicker.SelectedDate && RepairOrderDate >= DatePickerStart.SelectedDate,RepairOrderDate <= DatePicker.SelectedDate))))),"RepairOrderDate",If(SortDescending1,Ascending,Descending),"RepairOrderId",Descending)

Orders are linked in D365 to Employees through varsite.Site which is already define.

BCBuizer
Super User
Super User

Hi @jasirqadri123 ,

 

Looking at the code you have to define varSite.Site, it does indeed not contain site information, but employee information:

 

Set(
			varsite,
			LookUp(
				Employees,
				'Personnel number'=TextInput1_1.Text
			)
		)

 

When I then look at your filter I see you are already using that:

 

		...Filter(
			RepairOrderTables,
			WarrantyStatus = Dropdown.Selected.Value &&
			Site = varsite.Site &&
			(If(....

 

Apart from it being confusing to use a variable called "Site" to store Employee information, how is this supposed to work?



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,021)