Home › Forums › SPJS-Lookup › SPJS-Lookup with SharePoint Online
- This topic has 6 replies, 2 voices, and was last updated 6 years, 3 months ago by Alexander Bautz.
-
AuthorPosts
-
-
August 23, 2018 at 18:32 #21931
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.
-
August 23, 2018 at 18:43 #21934
Yes it does. If you have trouble, please hit F12 > Console and post any error messages here.
Alexander
-
August 24, 2018 at 22:01 #21942
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/. -
August 24, 2018 at 22:03 #21944
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
}); -
August 25, 2018 at 09:42 #21946
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
-
August 25, 2018 at 15:08 #21948
Thanks Alexander,
Changing the quotes and putting the query on 1 line worked!
-
August 26, 2018 at 08:31 #21950
Thanks for the feedback – I’m glad you got it running.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.