SPJS-Lookup with SharePoint Online

Forums SPJS-Lookup SPJS-Lookup with SharePoint Online

Viewing 6 reply threads
  • Author
    Posts
    • #21931
      Josef Wainz
      Participant

      Can someone confirm whether SPJS-Lookup works with Office 365 SharePoint Online or not?

      I’ve searched the forums, and Google, but have come up empty.

    • #21934
      Alexander Bautz
      Keymaster

      Yes it does. If you have trouble, please hit F12 > Console and post any error messages here.

      Alexander

    • #21942
      Josef Wainz
      Participant

      The lookup works now, except for the filter. Here is the filterObj:

      “filterObj”: {
      “on”: true,
      “folder”: “”,
      “CAML”: <Where>
      <Eq>
      <FieldRef Name=”Result” />
      <Value Type=”Text”>Approve</Value>
      </Eq>
      </Where>,

      The parser errors on <Value Type=”Text”>Approve</Value> with: “Unclosed regular expression”

      Below is from F12 > Console:

      init.js:1 Uncaught DOMException: Failed to read the ‘cssRules’ property from ‘CSSStyleSheet’: Cannot access rules
      at q (https://static.sharepointonline.com/bld/_layouts/15/16.0.8015.1218/init.js:1:171491)
      at https://static.sharepointonline.com/bld/_layouts/15/16.0.8015.1218/init.js:1:172368
      at arguments.(anonymous function) (https://static.sharepointonline.com/bld/_layouts/15/16.0.8015.1218/init.js:1:99822)
      jquery.js:4 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help, check https://xhr.spec.whatwg.org/.

    • #21944
      Josef Wainz
      Participant

      Here is the entire Custom JS:

      spjs.lookup.init({
      “fieldToConvertToDropdown”: [
      “DFFSLookup”
      ],
      “listName”: “List for FLow”,
      “listBaseUrl”: “/sites/dev”,
      “optTextFieldInternalName”: “Title”,
      “optValFieldInternalName”: “ID”,
      “orderBy”: {
      “fin”: “Title”,
      “ascending”: true
      },
      “clearInvalidSelections”: true,
      “filterObj”: {
      “on”: true,
      “folder”: “”,
      “CAML”: <Where>
      <Eq>
      <FieldRef Name=”Result” />
      <Value Type=”Text”>Approve</Value>
      </Eq>
      </Where>,
      “fin”: “Result”,
      “isLookup”: false,
      “operator”: “”,
      “filterVal”: “”
      },
      “dropDownDefaultvalue”: “”,
      “parseFunction”: “”,
      “addYouOwnValue”: {
      “on”: false,
      “linkText”: “Write your own value”
      },
      “addToExternalList”: {
      “on”: false,
      “customFunction”: null,
      “linkText”: “Add new item”,
      “saveNewItemText”: “Save new item”
      },
      “debug”: false
      });

    • #21946
      Alexander Bautz
      Keymaster

      Hi,
      You must use double quotes around the CAML and single quotes (or escaped double quotes) inside – like this:

      "CAML": "<Where><Eq><FieldRef Name='Result' /><Value Type='Text'>Approve</Value></Eq></Where>"

      Alexander

    • #21948
      Josef Wainz
      Participant

      Thanks Alexander,

      Changing the quotes and putting the query on 1 line worked!

    • #21950
      Alexander Bautz
      Keymaster

      Thanks for the feedback – I’m glad you got it running.

      Alexander

Viewing 6 reply threads
  • You must be logged in to reply to this topic.