GetItemCount for an external list returning zero

Hi,
I need to get the count of items in an external list in the client side. I have used the ecmascript to get the count.
However I am getting the count as 0. For native lists, it is returning the count.
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(MainFunction, "sp.js");
var objContext = null;
var objWeb = null    
var objList = null;
var objItem = null;
    function MainFunction() {  
        objContext = new SP.ClientContext.get_current();
        objWeb = objContext.get_web();  
        objList = objWeb.get_lists().getByTitle("Product");
        objContext.load(objList);
        objContext.executeQueryAsync(Function.createDelegate(this, this.onSuccess), Function.createDelegate(this, this.onFail));  
    function onSuccess(sender, args) {
        alert('Item Count: ' + objList.get_itemCount());
    function onFail(sender, args) {  
        alert('Some error has occured.');  
 </script>
Please let me know what I am missing.

Hi,
Why are you doing this if its an external list?
objContext = new SP.ClientContext.get_current();
objWeb = objContext.get_web();
Provide the appropriate web object where this external list resides.

Similar Messages

  • External lists for updating marketing attributes

    Hi,
    I'm now working in CRM 3.1, but we're going to upgrade for 5.0 in the autumn. In this relation I'm working on a pre-project where I'm looking for the possibilities for using external lists for updating marketing attributes on existing BPs. How can I map this fields? Do I use advanced mapping fields or structure enhancement using appended fields?
    Thanks, Camilla

    Camilla,
    Yes, this function become standard for CRM 5.0. CRM5.0 ELM provide different format types for create BPs (with marketing attributes), activities and leads. You need to define different format type when you create mapping format. For updating marketing attributes, you need to choose type  "Business Partner" type so that all the marketing attributes will be available for you to pick to create the mapping format.
    You can look at the CRM5.0 release note and document for more details
    Regards,
    Min

  • Failed to update a list item to external list

    I'm getting below error when I try to add my record to external list. This happen when spExternalItem.Update for 2nd time. I have value in my params
    "Failed to update a list item for this external list based on the Entity (External Content Type) 'SA' in EntityNamespace 'Triggers'. Details: Null was returned to FindSpecific (Read Item operation)."
    SPList spExternalList = contentDb.Sites[0].RootWeb.Lists["SA"];
    List<string>
    lstMachineNames = GetMachineNames(lstWarehouseTaskRecords);
    foreach(stringstrMachineName
    inlstMachineNames)
    SPListItemspExternalItem = spExternalList.Items.Add();
    spExternalItem["FormType1"]
    = "WH";
    spExternalItem["SerialNum1"]
    = strMachineName;
    spExternalItem.Update();
    Serial Number is "map to identifier" in External Content types. "Required" and "Read-only" check box is uncheck. Anyone has any idea? please help.
    [UPDATED 7 May 2014]
    I believe it is due to BDC problem. I created another column called ID so I can map this ID column as identifiers instead of using SerialNum1 and this error solved!

    Hi,
    As you said, the error thrown when executing the Update method for the second time.
    I suggest you debug your code in Visual Studio and keep watching the values of objects in use to get more details about the root cause of the error.
    What’s more, you can take a look at the posts from Dimitry and Scot in this thread with similar error message:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/29fb464f-3539-40c4-91c5-216b0363b8ef/null-was-returned-to-findspecific-read-item-operation?forum=sharepointdevelopmentprevious
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Patrick Liang
    TechNet Community Support

  • Create document set by workflow based on external list

    Hello,
    I'm wondering if the following is possible:
    I have a external list with all my projects.
    Next to that i have an document library where i place all the documents about the projects in document sets. Is it possible to automatically create the document sets based on the external list?
    So when a new record is created in the database (External list) it automatically creates a document set. (The document sets have an external data column which refers to the projects external data)
    I was thinking of an workflow, but i don't know how to accomplish this. I'm just a beginner with SharePoint.
    Kind regards,
    Robbert-Jan

    Hi Robbert ,
    According to your description, my understanding is that you want to create a document set for an external list in SharePoint 2013.
    For achieving your demand, you can refer to the article:
    http://msdn.microsoft.com/en-us/library/ff394479(v=office.14).aspx
    http://blogs.msdn.com/b/chandru/archive/2013/08/10/sp2013-creating-document-set-using-workflow.aspx
    One thing to notice is you cannot associate workflow with External List because workflow engine cannot run on back end system.
    Reference:
    http://siddiq-sharepoint2010.blogspot.in/2011/12/bussniess-connectivity-services.html
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Add/update an item to an external list using Designer WF

    Hi,
    I have two lists (A & B). A- regular SharePoint list, B- External list.
    Now, I have a Designer WF on A to add/update the items to the B. Unfortunately, SP 2013 killed the feature to update the external list directly using Designer WF 2013. However, I was able to use REST services to add/update item to the external list from
    the browser either using Fiddler or Mozilla client side tools.So I thought I could use Designer HTTP call action to achieve this.  But when I tried to use the HTTP call from the Designer WF, it won't add/update the items to B. I thought I was doing some
    kind of mistake while doing that HTTP call, so I tried replacing the list guid to some other regular list and it works. Its not working for an external list but working for any regular list.
    I'm not sure why I could not do that using the Designer while I can do it from browser. Can someone please help me out?
    Thanks!
    Thanks, Hitchs

    Hi Jeroen,
    Use following funtion call with mentioned parameters
    call function 'CRM_ORDER_MAINTAIN'
          exporting
            it_status         = lt_status1
          changing
            ct_input_fields   = lt_input_fields
          exceptions
            error_occurred    = 1
            document_locked   = 2
            no_change_allowed = 3
            no_authority      = 4
            others            = 5.
    here in for parameter lt_status1 u can fill up your required status and then execute the FM.
    After that execute FM BAPI_TRANSACTION_COMMIT.
    Best Regards,
    Pratik Patel
    <b>Reward with Points!</b>

  • Lookup column only return 201 items from external list

    I have a BCS external list which contains about 700 items. I already set the BCS Throttle limit to 50000 items (default) and 1000000 (max). I can view all 700 items in the external list.
    I created a regular lookup column in a custom list to lookup the external list. When I click the drop-down, it only returns the first 201 items with a red message "Warning: Too many results have
    been returned. This result set may be incomplete or truncated.". I need all items available for selection so set up a filer will not work for me.
    I just wonder if there is any work around for the issue. Many thanks.

    This is unfortunately the default behavior with external content type. The limit is set at 201.  You can however avoid this by setting appropriate filters to limit the number of results to less than 200. The user can use wildcards in their filter to
    more fine tune the results returned.
    Read more on how to set filters on external content type here:
    http://blogs.msdn.com/b/bcs/archive/2010/05/05/why-it-s-important-to-define-filters-for-a-good-picking-experience.aspx
    Thanks, Ransher Singh, MCP, MCTS | Click Vote As Helpful if you think that post is helpful in responding your question click Mark As Answer, if you think that this is your answer for your question.

  • External List: List View Web Part query never returns

    I am experiencing an usual issue in our development SharePoint 2013 environment. I have been troubleshooting it for a couple hours, so thought it is time to post a message here.
    I have created a number of external content types and lists on our site. I have validated that the lists display the expected data.
    However, when I add a page to our site, and add a list view web part to the page, and point the list view web part at the external list, I get unexpected behavior.  While I am editing the page, the web part displays the expected data. However, after
    I publish the page, when you browse to the page, all you get is the rotating green arrow gif image, and no data. It displays the image forever. If you then attempt to edit the page, in the editor, you can then see the expected data.
    Any thoughts on what might be causing this issue? I have tried switching out web parts, both to the Business Data List and the Content Query web part. The Content Query web part throws an exception if you attempt to point it at any of the external lists,
    which after some reading I discovered that this is a known issue with that web part.
    The Business Data list web part shows the expected data, but I have been unable to get paging/grouping working with that web part yet.
    Greg Pierson

    I have recreated this issue on a clean site collection. I have also discovered this issue only occurs with publishing pages, not site pages. next step is to try to reproduce it on another share point 2013 install.
    Greg Pierson

  • Looking for a way to pass parameter to external list from infopath

    Hey, i have a Sharepoint 2010 list for which I want to create Infopath form. I have an external content type and external list based on it.
    I want to prepopulate some fields in my Sharepoint list with data from external list. I tried to use external list as a secondary data source and query it for needed values. The issue I encounter is that my ECT has a finder with filter and I can't figure
    out how to pass a value to this filter within infopath.
    How can it be done with infopath? How can I pass the filter value to the external list using Infopath?

    Hi,
    According to your post, my understanding is that you wanted to pass parameter to external list from infopath.
    You need to query the external list from InfoPath using coding and CAML Query.
    Here is a similar thread for your reference:
    http://sharepoint.stackexchange.com/questions/33575/filtering-sharepoint-external-list-bcs-from-infopath
    Thanks,
    Linda Li
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • FM for add sales area to a BP from external lists

    Hi experts
    We are uploading BPs from an external list (on WEBGUI), and we want to add the sales area to this one.
    We tried to use FM CRM_BUPA_FRG0010_ADD but it doesn't work.
    Do you know any FM for solve this issue??
    thanks in advance
    Best regards
    Marco
    Edited by: Menegazzo Marco on Jul 5, 2010 10:53 AM

    Hi Marco,
    use this FM instead.
    CRM_BUPA_FRG0140_ADD
    And don't forget to commit work!
    Bye

  • Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. when open external list

    Hi
    i created a external list based on a external content type in shaepoint designer
    but i got this error in event viewer when i open this list
    Could not open connection using 'data source=xxxx;initial catalog=xxx;integrated security=SSPI;pooling=True;persist security info=false' in App Domain '/LM/W3SVC/1756231635/ROOT-1-130330475307091531'. The full exception text is: Login failed for user 'NT
    AUTHORITY\ANONYMOUS LOGON'.
    I created bcs service with Users Identity  and my web application using claims based authentication
    and sql server in  seperate server under a domain.
    all servers are in same domain
    adil

    Most likely you are running into double-hope issue. 
    Read following article and implement the workaround that works for you.
    http://www.spdoctor.net/Pages/message.aspx?name=login-failed-for-user-bdc
    I am assuming your are using NTLM in your farm. If you are using Kerberos then check the following article.
    http://blogs.technet.com/b/harmeetw/archive/2011/08/28/getting-login-failed-for-user-nt-authority-anonymous-logon-when-browsing-external-list-on-a-claims-kerberos-web-application.aspx
    Amit

  • Looking for a way to provide a subscription like service through an external list

    I have a sql server database containing issue tickets that have been opened.
    I have a second database that contains the names of the various devices and software packages against which one can report issues.
    A user asked if there was a way for us to provide a way to "subscribe" to particular devices, so that any time an issue arose relating to that issue, information could be sent.
    I have been playing the past week or so with external lists.
    I was wondering if there is a way to set up things using infopath and sharepoint so that:
    a. the user is provided with a drop down/scroll list of the various devices available.
    b. At this time, this list is pretty long - more than a thousand.
    c. After selecting the item, the user would be shown a sharepoint list of all issues relating to the device in question.
    d. The user would then be able to bookmark the page, or perhaps even set up an alert, when they wanted to see whether anything new occurred.
    e. RSS would really be nice, but I know that out of the box, SharePoint does not support RSS for external lists. I don't have the skills to write something to provide that sort of add on functionality.
    Is this something doable? Has anyone set up something like this?
    Thanks

    As per your requirement. Creating custom solution is only option.
    http://sharepoint.stackexchange.com/questions/85582/alerts-on-sharepoint-2013-external-list
    I have the same issue but I believe that even though setting alerts on external lists is now possible it's not easy to do in practice if you're not a programmer. From what I've read you need to write code using Visual Studio and create an "event receiver".
    This is really disappointing and I hope Microsoft address this issue in a future service pack, or at least provide an easy step-by-step guide (including code) which the average SharePoint administrator could follow to achieve the desired result. I did manage
    a partial work-around by creating a list in SharePoint and adding external columns 

  • SP2013: create webpart for external list

    Hi there, 
    I have created an external content type and a external list for several entities from an sql server database. What I want to do now is, to develop a webpart / form (most likely in Visual Studio 2012) where I can add functionality to that external list. E.g.
    I want to use an file picker dialog in order to select a document library and store it's ID to a field in the external list. Stuff like that.
    Can anyone give me some points to start from? Actually I have read a lot about the basics of webpart developement, but in that case I'm not sure how to start extending this external list to a GUI with several functions for the users.
    Would be awesome to get some help here,
    kind regards, Jill

    Hello Jill,
    Please check the below post below it addresses the same question
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/06389ca3-9148-4de8-ba08-f275564358f4/external-list-with-custom-forms-neweditdisplay?forum=sharepointdevelopmentprevious
    Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010

  • BCS Connectivity to access External List for FBA

    Hi,
    I am facing an issue while connecting the External List created for External Users(FBA).My requirement is to display the External list data for External users,So for that i Have configure FBA and throught BCS i am trying to display the External list.
    But the issue which i am facing here is on click of External List created in designer I am getting Error Access denied for domain\username.As i know if my SQL is on different server I need to use Secure store service to get the Application ID and map it
    to database.I also tried  with these approach still i am getting the same Access denied error.
    Please help me if any one has overcome with same issue.
    Thanks Regards,
    Simanchal

    Hi Simanchal,
    Whether this issue occurred for internal user.
    Please check whether you set access on the BCS object that you created. Go to Central Administration -> Application Management -> Manage Service Applications -> Business Data Connectivity Service* -> [Your Entity] -> Set Permissions.
    If the above solution doesn’t work, please set Metadata Store Permissions on the BCS object, compare the result.
    There is a link for your reference:
    http://stackoverflow.com/questions/4168309/sharepoint-bcs-sss-help-needed
    If this issue still exists, please check the log file to find more information about this issue. The path of the log file is : C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Rich text data type for external list

    Hi,
    I need to create an external list with one column as rich text type where they can highlight the text and all.
    How this can be done, since with external lists the column is rendered as single line of text?

    Hi,
    External content types are made up of fields whose types are a subset of the primitive types of .NET. For each such .NET type, a rudimentary mapping to SharePoint’s field controls exists, describing a field’s visual appearance. Fields of type string for
    instance will, on the new and edit forms, render as a single-line text field. With regular lists, using the browser interface, you can easily turn a string field into a multi-line text area or a Rich Text field, but not so with external lists. At least not
    unless your forms are InfoPath-based.
    Please take a look at these resources:
    Evaluating Business Connectivity Services in SharePoint 2010 for web service, read/write use
    Customizing the External list
    Multi line text box in External List edit form
    Reference:
    https://social.technet.microsoft.com/Forums/en-US/0fcb5a9f-8445-4a37-9e60-ac5e9e14e8f1/sharepoint-designer-external-content-type-shows-single-line-text?forum=sharepointgeneralprevious
    Thanks,
    Eric
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Column header filtering not functioning for external lists

    I have a problem with column header filtering on external lists, specific for columns of Number and Date types.
    When the site's regional settings are in English (United States) filtering works fine, but if I choose any other regional setting with different number formatting (ie Dutch) then filtering on these columns gives no results.
    When clicking on the column header filter dropdown, the numbers to filter on are displayed with thousands seperators where the numbers in the views are not formatted as seen in attached screenshot.
    Filtering on custom sharepoint list with these regional settings is working fine, it is just on external lists, on number and date fields and regional setting is not English.
    I have tried all different kind of regional settings on the client and the server, but no results.
    Anybody has a clue?
    Clicking on the column header shows all available filter values (with thousand seperator). Selecting one value gives no results:
    No results after selecting a filter value

    Hi,
    According to your post, my understanding is that you had an issue about column filter in external list.
    We can use the SharePoint Manager to change the column type to “single line of text”, then you would filter column in the external list.
    There is a similar thread for your reference:
    http://social.technet.microsoft.com/Forums/en-US/fe67d581-6e7b-4770-b296-8ec0f9b5b769/not-able-to-filter-or-sort-by-list-column-headers-for-external-data-fields-ideas?forum=sharepointgeneralprevious
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

Maybe you are looking for