Skip to main content

Hello

I'm a newbie K2 Five
I need expert help


I created a SMO where I can enter user login and level.
for example
user - access level
user1 - 1
user2 - 1
user3 - 2
user4 - 3
....

How can I set up a rule so that I can show or hide some element on a form for all users of the same level?

How create condition for "if an advanced condition is true" rule?
What is the best way to do this?

Hi,


I am assuming you want to hide or show elements on your form base on the access level for that particular user.


 


Here is what I will do in general:



  1. In your form, create a data label to store the user's access level. Set the data label property to hide it.

  2. Go to rules, and add a "When form is initialized" rule.

  3. Under that rule, add a rule to call your SmartObject. Pass in the username in input mapping, and in output mapping, map the access level to the data label created in step 1. You can grab the current user's username in your rule by using the Context Browser, expand System Values > Current User > FQN. You can of course use the Name or Email, depending on what user property you used to map the user to their access level.

  4. Now you have a hidden data label, with the user's access level. You can use that to create additional conditions to hide or show controls on your form.

  5. Still within the "When form is initialized" rule, add "a control contains a specific value" condition.

  6. Configure the condition rule to check if the data label created in step 1 matches a certain value.

  7. Then under that condition, you can add rules to show or hide the controls you want.

  8. Repeat step 5 to 7 for the other access level in your list.

  9. You can add "and" to a existing condition you have added, then add another condition from the conditions list on the left.


If its a simple condition, I do not recommend using advance condition as advance condition are not exactly very visible. In order to determine what condition has been configured, you need to click on the Configure link. The other condition rules will just display up front what condition you have configured, so it is a lot easier for you to figure out what is going on just by browsing through your rule list.


 


Reply