Send current user's parameter to External Content Type
-
Thursday, September 13, 2012 6:20 PMIs it possible to send the current user's username as a parameter for my External Content Type query? I am on SharePoint 2010 Standard.
All Replies
-
Friday, September 14, 2012 9:01 AMModerator
Hi Rick131,
Base on my research, we can only get Business Data Connectivity Filter to work with external content type/list. But Business Data Connectivity Filter can’t use to get current user.
So a workaround is to create a data source and directly get data from your data base. And use current user filter directly to filter a data view web part which you used to display the database data source.
(And you can also try to add a filter directly in view settings page, set your field = [Me], but I failed to get it work this way because of an invalid data type.)
Thanks & Regards,
EmirEmir Liu
TechNet Community Support
-
Friday, September 14, 2012 9:30 AMHi,
additionally to the one from Emir Liu please take a look at this thread with possible solutions How to get [Current User] on a Business Connectivity Services(BCS) ListDmitry
Lightning
Tools Check out our SharePoint tools and web parts |
Lightning Tools Blog -
Monday, September 17, 2012 12:50 PMI had created an External Content Type List using SQL Server's SUSER_SNAME() function to get the current user's user name but it seems to get the server's SharePoint Farm Admin User Name.
-
Monday, September 17, 2012 12:52 PMAre BCS list available in the Standard version?
-
Monday, September 17, 2012 1:54 PM
I had created a Data Source but which type of Web Part would I need to connect to the Data Source? I changed the SQL View to show records for all users, with the UserID field in the follwoing format: "Domain\User". Where do I find the current user filter web part?
-
Monday, September 17, 2012 7:52 PM
Hi,
Please take a look at this article External Lists (BCS): Read List User Context filter
Dmitry
Lightning
Tools Check out our SharePoint tools and web parts |
Lightning Tools Blog- Marked As Answer by Emir LiuMicrosoft Contingent Staff, Moderator Thursday, September 27, 2012 5:54 AM
-
Wednesday, September 19, 2012 11:33 AMI am stuck on the third step, which is to add the Filter to the Read Item. I get the error: "This operation will be saved without filter property for data source element UserID. The data source element must be defined as a field, identifier, or foreign identifier to add this property."
-
Thursday, September 20, 2012 9:18 AM
Hi,
What is UserID column? In order for the field to be filterable you need to map it to an identifier (primary or foreign key identifier).
Dmitry
Lightning
Tools Check out our SharePoint tools and web parts |
Lightning Tools Blog -
Thursday, September 20, 2012 10:52 AM
UserID is my user\domain field in the External Content Type (SQL Server View). If I select to "Map to Identifier" I get the error messages:
- The data Surce elements TransactionNo, UserID references to the same identifier:TransactionNo. Make Sure that each data source element is mapped to an identifier that is not already referenced or remove the mapping.
- Data Source element UserID is of data type Syste,.String, the mapped item TransactionNo is of data type System.Int32.These data types cannot be converted automatically at runtime.
- For this data source element TransactionNo the 'read-only' and 'required' properties are set to true. This is a valid combination used only for write-once scenarios. Make sure that this is the intended scenario.
- Data source element UserId has null-able type. Null able identifiers are not supported in Business Data Connectivity. A null value returned from this data source may cause run-time errors.
TransactionNo is the primary key. The last message doesn't bother me much since I can filter out the nulls in the view.
-
Wednesday, September 26, 2012 12:26 PMYou shouldn't map TransactionNo, UserID fields to one identifier TransactionNo. There should be 2 different identifiers TransactionNo, UserID.
Dmitry
Lightning
Tools Check out our SharePoint tools and web parts |
Lightning Tools Blog -
Wednesday, September 26, 2012 12:47 PMHow would I create another Identifier?
-
Wednesday, September 26, 2012 12:50 PM
I managed to set a filter using this post. I created a SQL Server View with all the User Names and used the artice as a guide to create a filter based on the current user using User Context filter.- Edited by Rick131 Wednesday, September 26, 2012 12:50 PM
- Marked As Answer by Emir LiuMicrosoft Contingent Staff, Moderator Thursday, September 27, 2012 5:53 AM
-
Wednesday, September 26, 2012 6:08 PMglad you got it working.
Dmitry
Lightning
Tools Check out our SharePoint tools and web parts |
Lightning Tools Blog

