cancel
Showing results for 
Search instead for 
Did you mean: 

pass current site name to repository webscript

romschn
Star Collaborator
Star Collaborator
Hi,

I want to pass the current site name of share to the repository webscript.

I am invoking the repository webscript in javascript as below.

var result = remote.call("/xyz/xyz");

I tried below two ways of passing current site name in the webscript URL but couldn't get it working.
1.  var result = remote.call("/xyz/xyz?sitename=" + Alfresco.current.SITE);
2.  var result = remote.call("/xyz/xyz?sitename=" + page.url.templateArgs.site);

Could anyone please help me on this? What am I missing?

Thanks,
2 REPLIES 2

shahsnehal
Champ in-the-making
Champ in-the-making
From where are you calling repository web script?

If you are calling repository web script from any of the site-webscripts –> component/module .. then you can use "page.url.templateArgs.site".

If you are calling from Repository Browser or User Dashboard or User Dashlet - you will not be able to get current site as site is not listed at that time.

If you are calling from Share side JS file (tomcat\webapps\share\components), then you need to have a siteId attribute in your JS file and that must be set from server side site-webscript. Then only you can use the same.

tapan_d_thakkar
Champ in-the-making
Champ in-the-making
From where are you calling repository web script?

If you are calling repository web script from any of the site-webscripts –> component/module .. then you can use "page.url.templateArgs.site".

If you are calling from Repository Browser or User Dashboard or User Dashlet - you will not be able to get current site as site is not listed at that time.

If you are calling from Share side JS file (tomcat\webapps\share\components), then you need to have a siteId attribute in your JS file and that must be set from server side site-webscript. Then only you can use the same.


Hi as Snehal said you can get siteName using "page.url.templateArgs.site".

and if you want siteName in share side js .. you can use " Alfresco.constants.SITE ", this will give you current site.