Је Развили смо ИнфоПатх образац са више приказа да подржи нову изнајмљивање / on-boarding process. When the company hires a new person, ИТ одељење и друге групе треба да предузме акцију (подесите плате, омогући приступ одговарајућим апликацијама, пронађите радни сто, итд). We use on form but a different view of the form for each of those functions.
At this company, most of the people involved in the business process are IT-savvy, so when they access the form, their default view is a "menu" view with buttons that direct them to their specific function. Међутим, we needed to simplify things for the new hire’s direct manager. This person should not see any of the IT related stuff. Заправо, she should see just one view of the form and not even have an option to see the other views.
У нашем случају, that direct manager’s account is directly tied to the form courtesy of a contact selector (which I am always wanting to call a "people picker" for some reason).
The steps are as follows:
1. In design mode, go to Tools -> Форма Оптионс -> Open and Save.
2. Select "rules".
3. Create a new rule whose action is "switch to view" and whose condition leverages the userName() функција.
усерНаме() returns the "simple" user name without the domain. If I log into SharePoint with credentials "domain\pagalvin", усерНаме() returns "pagalvin".
The contact selector provides three bits of information for a contact. The "AccountID" portion is most useful for this scenario. The only thing that makes this even a little bit of challenge is that the contact selector (in my environment anyway) returns the domain and user ID, as in "domain\pagalvin". This prevents us from doing a straight-forward equality condition since AccountID ("domain\pagalvin") will never equal userName() ("pagalvin").
We can get around this using the "contains" operator: AccountID contains userName().
We can take it further and pre-pend a hard-coded domain in front of the userName() function to get our equality check and eliminate the risk of a false positive on the contains operator.
We would have REALLY like to automatically switch view for other users based on their AD security group membership. На пример, when a member of the "IT Analytics" group accesses the form, automatically switch to the IT Analytics view. We didn’t have time to implement it, but my first thought is to create a web service that would have a method like "IsMemberOfActiveDirectorySecurityGroup", pass it the userName() and return back true or false. Does anyone have any other, more clever idea? Is there any SharePoint function we can leverage from InfoPath to make that determination?
</крај>
Many Thanks Mr. Павле
Типе: Infopath Switch View Based On User « Sladescross's Blog