Retrieving data for a logged in user in UI Builder

I’m sorry if this is a basic question, I’ve watched the masterclass videos and searched the documentation and I can’t find how to make this work.

What I am trying to achieve is:

I want to format text and other elements for a logged in user within a form based on Boolean values in a database table.

So in the form I need to be able to use an if function that says:

If the logged in user’s stage1Complete value in the UserDetails table is true, set the text to ‘XYZ’ else set text to ‘ABC’

Hello @Luc_Zentar

Thank you for contacting the forum. We have prepared a solution according to your request and added it to our knowledge base. I hope this solution will help you.
https://support.backendless.com/docs?topic=13445

Regards,
Inna

Hi @Inna_Shkolnaya , thank you for this. I’m having a problem making it work, the only difference is that on my use case, the user does not log in on the same page, but has already logged in before reaching this page. I’ve tried to replicate your method using this:

But the titleText does not show on the page when tested.

@Luc_Zentar

Try changing the logic as follows:

Regards

Hi @Inna_Shkolnaya , I have tried this and it is not working. My problem is that user email and password don’t exist in form data for the page, because the login form is on another page. Instead I have set currentUser to Get current user - this is the only difference to your solution and so I suspect this is the problem.

Thanks!

Hello @Luc_Zentar

You can save the result of “Login user” block in the App Data, then get it on another page

Regards,
Viktor

Hello @viktor.liablin

This isn’t working for me. I can save the result of login user in app data, I have tested this by then rendering a text element with data binding with the result of the email and password results.

Logic:

Result

But when I try to replicate this on a separate page with exactly the same logic, it doesn’t work.

Logic

Result

I am also worried that this method passes an unprotected password that can be viewed in the console tab:

Thanks for your help

Hello @Luc_Zentar

I see what you mean
Your logic on first screenshot of this topic is ok
I think the problem is that you try to get ownerId of “userDetails” table. But ownerId is empty.
I see you have userId column that related to “user” table.
Try this

31

Also I recomend you check is currentUser exist in this logic

Regards,
Viktor

@viktor.liablin It works!

Thanks to everyone for helping with this :slight_smile: