Unable to fetch roles in IF widget after new update
Application Type
Reactive

Since I got the new updated Outsystems (2 days ago), I'm unable to fetch the condition to check the role. If I try to check the custom roles in the IF widget condition, it says that it's unable to locate the role in expression even when the role is reflecting in the Roles folder of logic tab. Below is the attached screenshot of the error.

Any suggestion would be really appreciated!

Check Role error.png

Solution

Hello,

I have updated your Oml now its working You can check It 

Link-https://personal-ejuytnht.outsystemscloud.com/ELearningZone/Home?_ts=637928721539060548

hope it will help you now

Thanks

ELearningZone_Updated.oml

Hi @KUNAL DHOBLE ,

Are you developing a reactive or a traditional web app? If you're developing a reactive app, you can't use roles directly in an if widget.

Cheers

Hello @KUNAL DHOBLE
You cant call it Directly on screen Since Server connection is built when you check role

Add a data action on your screen and in that action you can pass your role action

add a output parameter(boolean type) on your data action, then use that output parameter in your if widget to check your condition

Check Attached Oml

Thanks

Sample_Check_Role.oml

Hi Tousif,

Hope you're doing well!

First of all thank you for that OML because I was unaware that even we can use the role directly in the flow. But what I'm trying to do is that set the visibility of the button, if user has INSTRUTOR role he should have access to add button but if user has LEARNER role the button should not be visible. I have tried directly changing the visibility condition to check role as well as apply IF widget to button and assign CHECKLEARNERROLE() condition but none of those are working. Can you suggest me any other way how it can be achieved?

Cheers,

Kunal

May be you are doing something wrong, can you share oml or demo, so that i can check

When you log in from Instructor role and on data action you are calling check instructor role
so your data action will return True and Your CheckInstructorRole  boolean variable value will be True,

Now on Your visibility property your condition will be like CheckInstructorRole.HasRole

I hope this is what you wanted

Hi @KUNAL DHOBLE 

To get the desired output try following these steps,

Step1: Put Check Learner Role action in the Data action of the screen and assign the output of that action to the data action output parameter (Ex:hasLearnerRole).

Step2: Now try using that output parameter in the screen either by validating in If condition or directly applying that data action output parameter to the visibility property of the button.

Hope this helps!

Regards,
Saravanan Santhanam.



Hi,

I had attached the OML with this reply. I have 'Home' screen in which on the right top corner I have a button named 'Add Course'. In roles of logic tab, I had created two custom roles Learner and Instructor. I have a scenario where only Instructor should be able to add the course and the same button should not be visible for the learner. I have tried directly changing the visibility condition to check role as well as apply IF widget to button and assign CHECKLEARNERROLE() condition but none of those are working. Can you please check the OML and suggest me how this can be achieved?

ELearningZone.oml

Solution

Hello,

I have updated your Oml now its working You can check It 

Link-https://personal-ejuytnht.outsystemscloud.com/ELearningZone/Home?_ts=637928721539060548

hope it will help you now

Thanks

ELearningZone_Updated.oml

 Hi Tousif,

Thanks for your time and help. Issue resolved!


Cheers,

Kunal


You're welcome, @KUNAL  .

 Glad to help you :)

 Kind regards,

 Tousif khan


Hello Kundan, 
As Tousif suggested,  if it's a reactive application you need to add getAction as seen below in image for your reference.
 


Then use the output parameter in if condition to manipulate the button visibility.

Thanks

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.