تغییر نمایش بر اساس شناسه کاربر در فرم InfoPath

ما یک فرم InfoPath ایجاد شده بود با نمایش های مختلف برای حمایت از یک استخدام جدید / 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.

In our case, 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() تابع.

userName() returns the "simple" user name without the domain. If I log into SharePoint with credentials "domain\pagalvin", userName() 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?

</پایان>

برچسب ها:

3 دیدگاه در "تغییر نمایش بر اساس شناسه کاربر در فرم InfoPath

  1. اشتراک ها: سوئیچ INFOPATH نمایش بر اساس کاربر « وبلاگ Sladescross است

پاسخ

آدرس ایمیل شما منتشر نخواهد شد. بخشهای موردنیاز علامتگذاری شدهاند *