Skip to main content

I'm trying to use the lookup() function to access a list from a different site.

I'm tried to use lookup("/sites/bbb|listName", "Title","xxx","Title")  in site ("/sites/aaa/xxx"), and I got #Value!

I got a error message: :/sites/bbb|listName-xxxxxxxxxxxxxxxxxxxxxx] - A request for SharePoint data failed. Error details: List 'listName' does not exist at site with URL 'https://xxxxxxx.sharepoint.com/sites/aaa/xxx'.

 

And I researched this post, it said O365 does not supported for cross site yet in 2016.

(Ref: https://community.nintex.com/t5/Nintex-for-Office-365-Forum/Lookup-runtime-function-using-a-list-from-another-site/td-p/39679 )

 

However, I found the current limitation which is no mention about the lookup function is not able to access another site, and the Lookup control will now query across site collections within then tenant.

(Ref: https://community.nintex.com/t5/Responsive-Forms/New-Responsive-Office365-Current-limitations/m-p/89047)

 

Hence, Is lookup() function supporting for cross site now? Thanks a lot.

Hi,



 



On new responsive Forms :



Yes the function "Lookup" support the corss site.



Warning : There is a strange (bug ?) behaviour. You need to install the "Nintex Forms for O365" app on your target site, otherwise, you will never be able to retrieve lists from your target site.



 



On Classic (and old Responive form) : No the corss site is not supported. Between different site collection it's not supported. On the same site collection i thinks it's supported, but I'm not 100% sure.



 



ps : in the link of your previus post, it's the lookup control that support the cross site. 



 



In new responsive : the syntaxe of your function is wrong. There is a dedicated parameter for the URL of you site : 



https://help.nintex.com/en-US/Office365/Designer/Functions/Lookup.htm



 



Lookup("Invoices", "ID", "1045", "Title","/sites/Sales/APAC", ",")

 


Hi nico,



 



I tried the lookup() function in the new responsive form, and it is successful to get the value from another site.



However, as you mentioned, the classic form is not supporting the cross site lookup(), is it possible to  achieve the cross site effect in classic form in another way? thanks a lot.



 


Yes it's possible.
This can be done with JavaScript and CSOM or SharePoint Rest API
You will need to interact with the "SP.ProxyWebRequestExecutorFactory" to get your crosssite client context and after made some query to your remote site.

Or you can use the SharePoint Search to get your data from your target site. You will steel need to use JavaScript and CSOM / SharePoint REST API. What is interesting is that you can use your current context to interact with the search (and bring up info from a remote site).



 



To get your current context in Classic Forms, you can use this code: 



 



var pollSP;



NWF.FormFiller.Events.RegisterAfterReady(function () {

pollSP = setInterval(checkSPLoad, 500);

});



function checkSPLoad() {

if (clientContext) {

window.clearInterval(pollSP);

onSPLoad();

}

}



function onSPLoad() {

//Our code must come here

}


 



https://community.nintex.com/t5/Community-blogs/Hide-Edit-Item-button-if-user-is-not-allowed-to-edit-using/ba-p/79215



 



 


hello, has anyone been able to use lookup function with cross site functionality in classic form under form 0365 ?

Pls suggest 


The only way to achive this is to code some javaScript.

To do this you must use the crossDomain library from SharePoint. The cross Domain lib is compatible with CSOM or REST API.

Here is some help link with exemple of code:

https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/creating-sharepoint-add-ins-that-use-the-cross-domain-library

https://cann0nf0dder.wordpress.com/2013/04/20/cross-domain-and-sharepoint-hosted-apps-using-csom/

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5baeb648-a050-4df7-8dfc-c1144e9f14fd/explain-when-to-use-webrequestexecutorfactory-amp-spproxywebrequestexecutorfactory?forum=sharepointdevelopment


And from Nintex Classic form, you can get the HostUrl and APP Url directly from the URL of your form (parameter name SPHostUrl and SPAppWebUrl)


Reply