Cross-site lookup - 'Loading Failed' error

rss

Posted by kevyn - Aug 26 ’15 at 09:01

Hi there. I just installed a trial of Cross-site lookup for Sharepoint online (office 365) and added a new lookup to a list.

 

When I click the dropdown, it inputs all of the items from my list successfully, however if I try and enter text to search, it just says 'Loading error'

Please can anyone help?

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 9 years 8 months 16 days
    #1 by Dmitry Kozlov Aug 26 ’15 at 09:51

    Please, open the browser console (F12). Do any notifications appear there while you're typing?

  • kevyn
    Member
    Member for: 7 years 9 months 12 days
    #2 by kevyn Aug 26 ’15 at 10:00

    [#1]: The console shows:

    GET https://mydomain.sharepoint.com/sites/beta/_api/web/lists('%7B…swith(Project_x0020_Number_x0020_and_x,%20%27t%27)&$top=10&_=1440601055288 400 (Bad Request)

     

    this only happens when typing - if I use the mouse to select items from the drop down without searching it works ok

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 9 years 8 months 16 days
    #3 by Dmitry Kozlov Aug 26 ’15 at 10:02

    [#2]: Did you modify Request items in the Lookup Manager? Please, try to reset it.

  • kevyn
    Member
    Member for: 7 years 9 months 12 days
    #4 by kevyn Aug 26 ’15 at 10:05

    [#3]: I did not edit the advanced options

  • kevyn
    Member
    Member for: 7 years 9 months 12 days
    #5 by kevyn Aug 26 ’15 at 10:10

    I think I can now see the problem - the column I'm using is a calculated column with the following value:

     

    =[Project Number]&" - "&[Project Name]

     

    It seems that the search will not work with this calculated column (if I change it to a regular list item it works).

    Is there any work around for this please? thanks for your help

  • kevyn
    Member
    Member for: 7 years 9 months 12 days
    #6 by kevyn Aug 26 ’15 at 10:44

    [#3]: it seems any kind of calculated field does not work - is this a bug?

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 9 years 8 months 16 days
    #7 by Dmitry Kozlov Aug 27 ’15 at 06:28

    [#6]: It seems that SharePoint REST api does not allow to filter by calculated fields but you can configure filtering by multiple regular fields with the help of 'Request item' template following way:

    function (term, page) {
      if (!term || term.length == 0) {
        return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby=Created desc&$top=10";
      }
      return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&" +
        "$filter=startswith(field1, '" + encodeURIComponent(term) + "') or " +
        "startswith(field2, '" + encodeURIComponent(term) + "')&$top=10";
    }
    
  • kevyn
    Member
    Member for: 7 years 9 months 12 days
    #8 by kevyn Aug 27 ’15 at 07:23

    [#7]: Ok so using your example, I replaced 'field1' and 'field2' with my column names from the lookup list, however I got the same results. Is there any other area I should replace?:

     

    function (term, page) {

    if (!term || term.length == 0) {

    return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby=Created desc&$top=10";

    }

    return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&" +

    "$filter=startswith(Project Number, '" + encodeURIComponent(term) + "') or " +

    "startswith(Project Name, '" + encodeURIComponent(term) + "')&$top=10";

    }

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 9 years 8 months 16 days
    #9 by Dmitry Kozlov Aug 27 ’15 at 08:16
  • kevyn
    Member
    Member for: 7 years 9 months 12 days
    #10 by kevyn Aug 28 ’15 at 03:15

    [#9]: The URLs are as follows:

    column 1 is:

    beta/_layouts/15/FldEdit.aspx?List=%7B44B4850F-54F9-46F5-AA7D-F35E9CDD2C2D%7D&Field=Project_x0020_Number

    column 2 is:

    beta/_layouts/15/FldEdit.aspx?List=%7B44B4850F-54F9-46F5-AA7D-F35E9CDD2C2D%7D&Field=Title

    Therefore my new code is:

    function (term, page) {

    if (!term || term.length == 0) {

    return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby=Created desc&$top=10";

    }

    return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&" +

    "$filter=startswith(Project_x0020_Number, '" + encodeURIComponent(term) + "') or " +

    "startswith(Title, '" + encodeURIComponent(term) + "')&$top=10";

    }

     

    However I still get the same error - is there anything you can suggest please?

Displaying 1 to 10 of 18 messages
Previous12