none
Send current user's parameter to External Content Type

    Question

  • Is it possible to send the current user's username as a parameter for my External Content Type query? I am on SharePoint 2010 Standard.
    Thursday, September 13, 2012 6:20 PM

Answers

All replies

  • 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,
    Emir


    Emir Liu

    TechNet Community Support

    Friday, September 14, 2012 9:01 AM
  • Hi,
    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) List

    Dmitry

    Lightning Tools LogoLightning Tools Check out our SharePoint tools and web parts | Lightning Tools Blog

    Friday, September 14, 2012 9:30 AM
  • I 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:50 PM
  • Are BCS list available in the Standard version?
    Monday, September 17, 2012 12:52 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 1:54 PM
  • Hi,

    Please take a look at this article External Lists (BCS): Read List User Context filter


    Dmitry

    Lightning Tools LogoLightning Tools Check out our SharePoint tools and web parts | Lightning Tools Blog

    Monday, September 17, 2012 7:52 PM
  • I 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."
    Wednesday, September 19, 2012 11:33 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 LogoLightning Tools Check out our SharePoint tools and web parts | Lightning Tools Blog

    Thursday, September 20, 2012 9:18 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.

    Thursday, September 20, 2012 10:52 AM
  • You shouldn't map TransactionNo, UserID fields to one identifier TransactionNo. There should be 2 different identifiers TransactionNo, UserID.

    Dmitry

    Lightning Tools LogoLightning Tools Check out our SharePoint tools and web parts | Lightning Tools Blog

    Wednesday, September 26, 2012 12:26 PM
  • How would I create another Identifier?
    Wednesday, September 26, 2012 12:47 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.
    Wednesday, September 26, 2012 12:50 PM
  • glad you got it working.

    Dmitry

    Lightning Tools LogoLightning Tools Check out our SharePoint tools and web parts | Lightning Tools Blog

    Wednesday, September 26, 2012 6:08 PM