Link to home
Start Free TrialLog in
Avatar of MikeXna
MikeXna

asked on

Switching Views using User Roles and/or Open Behavior Rules

Hi,

I want to switch views if uername = a field on my InfoPath 2007 form.
Do I need to configure both User Roles and Open behvior Rules or just Conditional Open Behavior Rules?

I tried configuring my User Roles using the "User Name From the Form" option.
I have 5 different views so I created 5 differnt roles and 5 different text fields on my form, each containing a differnt managers user name.  These are populated from my filtererd data connection that successfully fills in the text field with the desired username accordingly, and 5 different open behavior rules.

Here is an example of an open behaviour rule that is currently not working:
Apply the Role when the Condition is True:
User Current Role is Equal to "Manager1 User Role"
Switch to View: Manager 1's View

 It sounds really straight forward but I must be missing something simple as it is not working.
Do you know what I may be doing wrong or am forgetting?
I don't fully understand when I should check the box "Stop Processing Rules when this rule finishes"
I have not been checking the box as I don't fully understand its purpose.  
Maybe I don't even need roles as it looks like i can set a condition so username = fileld on the form.
If I don't use User Roles, I dont think I can take advantage of the Initiator feature that allows the manager to submit a create a new form before the view gets switched on them...?

What is best way to switch a view when getting usernames from fileds on the form?
I have a default view i want to use but I am still trying to grasp the concept of the initiator and default role and the order in which they should be listed.

I appreciate your advice!  Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Clay Fox
Clay Fox
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MikeXna
MikeXna

ASKER

Thanks for your comment,  but I still need some help if you can.  I learned something new today.  I will try to explain.
By they way, you read my mind.  That is exactly what I am looking to do. I need my managers to be sent to their own view to approve the form and write comments, etc.

Today I deleted all of my rules and roles and started over.
I noticed that my problem seems to be related to how the mangers username is set as the default value in the corresponding manger form field.

Although I successfully used the wizard to set the default value by filtering my data connection to my employee directory list to enter "JSmith" in the field.  I know it works as I see "Jsmith in the field when I preview the form.  However InfoPath does not like for some reason and does not change the view when i set the condition to When Manager1field is equal to username.

But

When if I set the default value to the manager1 field manually to Jsmith and use the same condition, the view switches perfectly.

Any idea why InfoPath does not like my value when it is a result from a dataconnection filter?
I need to this work as I plan to create many many forms and do not want to edit each form when ever a new manger gets hired.

Thanks again for any suggestions you have!!!
It may be the case, when you compare text it needs to be exact.  The other thing is there can be hidden spaces on one side or the other.

normalize function will remove space.

translate function can set them all to caps.

www.infopathdev.com can be a good resource too.

You are doing the right thing and starting over and keeping it simple and testing it step by step.
Avatar of MikeXna

ASKER

Thanks.  I will try that.  I need to find the sytax to the normalize and trasnlate functions.
I tried using "contains" in the condition like so, but it did not work either.

Apply the Role when the Condition is True:
Manager1field contains userName()
Switch to View: Manager 1's View

That should have resolved any extra spaces or case sensitivity issues  too right?
It's not looking good for me. =(

If you think of anything else please let me know.
You would probably want normalize(Managerfield1) contains Username().  You may have to switch to an expression to put the normalize in.  Or you can have a rule triggered that sets Managerfield1 to normalize(managerfield1).

translate(managerfield1,"qwertyuiopasdfghjklzxcvbnm","QWERTYUIOPASDFGHJKLZXCVBNM") this will make it all caps.
Avatar of MikeXna

ASKER

I ended up creating AD Group to nest in appropriate users role.  That worked better for me. Thankgs again.