<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Capture site name or current url from javascript run in (Repository &amp;gt; Data Dictionary &amp;gt; Scripts) in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/capture-site-name-or-current-url-from-javascript-run-in/m-p/148378#M39225</link>
    <description>&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura de ecrã 2022-04-19 151823.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/1510i6A7672267F6B5B5E/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I'm having a hard time getting&lt;BR /&gt;the current url in the share.&lt;BR /&gt;I'm adding a script in Repository &amp;gt; Data Dictionary &amp;gt; Scripts&lt;BR /&gt;I need to capture the name of the site I'm on or the current url&lt;BR /&gt;but an error is coming.&lt;BR /&gt;&lt;BR /&gt;" 254 KB (Failure: Failed to execute script 'workspace://SpacesStore/9c2b6207-ed5a-48f1-9fa9-350616033cc0': 03190438 ReferenceError: "window" is not defined. (workspace://SpacesStore/9c2b6207-ed5a-48f1-9fa9-350616033cc0#9))&lt;BR /&gt;"&lt;/P&gt;&lt;P&gt;Thank you very much in advance.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2022 09:25:25 GMT</pubDate>
    <dc:creator>hernanisaurelio</dc:creator>
    <dc:date>2022-04-20T09:25:25Z</dc:date>
    <item>
      <title>Capture site name or current url from javascript run in (Repository &gt; Data Dictionary &gt; Scripts)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/capture-site-name-or-current-url-from-javascript-run-in/m-p/148378#M39225</link>
      <description>&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura de ecrã 2022-04-19 151823.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/1510i6A7672267F6B5B5E/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I'm having a hard time getting&lt;BR /&gt;the current url in the share.&lt;BR /&gt;I'm adding a script in Repository &amp;gt; Data Dictionary &amp;gt; Scripts&lt;BR /&gt;I need to capture the name of the site I'm on or the current url&lt;BR /&gt;but an error is coming.&lt;BR /&gt;&lt;BR /&gt;" 254 KB (Failure: Failed to execute script 'workspace://SpacesStore/9c2b6207-ed5a-48f1-9fa9-350616033cc0': 03190438 ReferenceError: "window" is not defined. (workspace://SpacesStore/9c2b6207-ed5a-48f1-9fa9-350616033cc0#9))&lt;BR /&gt;"&lt;/P&gt;&lt;P&gt;Thank you very much in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 09:25:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/capture-site-name-or-current-url-from-javascript-run-in/m-p/148378#M39225</guid>
      <dc:creator>hernanisaurelio</dc:creator>
      <dc:date>2022-04-20T09:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Capture site name or current url from javascript run in (Repository &gt; Data Dictionary &gt; Sc</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/capture-site-name-or-current-url-from-javascript-run-in/m-p/148379#M39226</link>
      <description>&lt;P&gt;AFAIK, window object wont work in repository webscript/script. Not sure though.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can elobrate the use case and requirement as to what exactly you are trying to do then some potential solution can be thought of.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 13:43:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/capture-site-name-or-current-url-from-javascript-run-in/m-p/148379#M39226</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2022-04-20T13:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Capture site name or current url from javascript run in (Repository &gt; Data Dictionary &gt; Sc</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/capture-site-name-or-current-url-from-javascript-run-in/m-p/148380#M39227</link>
      <description>&lt;P&gt;Mr. abhinav mishra&lt;/P&gt;&lt;P&gt;thank you very much for your time.&lt;BR /&gt;I intend to run this script in a specific folder on a site&lt;BR /&gt;How can I capture just the current site name in my script.&lt;/P&gt;&lt;P&gt;Thank you very much in advance&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 14:48:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/capture-site-name-or-current-url-from-javascript-run-in/m-p/148380#M39227</guid>
      <dc:creator>hernanisaurelio</dc:creator>
      <dc:date>2022-04-20T14:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Capture site name or current url from javascript run in (Repository &gt; Data Dictionary &gt; Sc</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/capture-site-name-or-current-url-from-javascript-run-in/m-p/148381#M39228</link>
      <description>&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/78419"&gt;@hernanisaurelio&lt;/A&gt;&amp;nbsp; You can use the root scoped object "document" and then get the &lt;A href="https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresco/repo/jscript/ScriptNode.java#L3442" target="_self" rel="nofollow noopener noreferrer"&gt;site name&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp;get-sitename-folder-rule.js (here 'document' is the folder node where you are creating the folder rule)&lt;/P&gt;

&lt;PRE&gt;logger.log("FolderDisplayPath where rule is created:  "+ document.displayPath);&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;var siteName = document.getSiteShortName();
logger.log("SiteName:  "+ siteName);&lt;BR /&gt;&lt;BR /&gt;//do whatever you want with the site name&lt;/STRONG&gt;&lt;/PRE&gt;

&lt;P&gt;Then you can use&amp;nbsp;&lt;A href="https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresco/repo/site/script/ScriptSiteService.java#L344" target="_self" rel="nofollow noopener noreferrer"&gt;siteService.getSite()&lt;/A&gt; or &lt;A href="https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresco/repo/site/script/ScriptSiteService.java#L380" target="_self" rel="nofollow noopener noreferrer"&gt;siteService.&lt;SPAN&gt;getSiteInfo()&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;to pull more info about site as needed, you will get Site or &lt;A href="https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresco/service/cmr/site/SiteInfo.java" target="_self" rel="nofollow noopener noreferrer"&gt;SiteInfo&lt;/A&gt; objects to play around.&lt;/P&gt;
&lt;P&gt;example:&lt;/P&gt;
&lt;PRE&gt;logger.log("FolderDisplayPath where rule is created:  "+ document.displayPath);

&lt;STRONG&gt;//get site short name from folder nodeRef
var siteShortName = document.getSiteShortName();
logger.log("SiteShortName:  "+ siteShortName);

&lt;FONT color="#FF0000"&gt;var siteInfo = siteService.getSiteInfo(siteShortName);
logger.log("Site Display Title:  "+siteInfo.getTitle());&lt;/FONT&gt;

//Or getSite

&lt;FONT color="#0000FF"&gt;var site = siteService.getSite(siteShortName);
logger.log("Site Display Title:  "+site.getTitle());&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 19:25:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/capture-site-name-or-current-url-from-javascript-run-in/m-p/148381#M39228</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2022-04-28T19:25:48Z</dc:date>
    </item>
  </channel>
</rss>

