<?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 Javascript - How to find the user name based on full name? in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76001#M24082</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;It may seems trivial but I cannot find the info!&lt;/P&gt;&lt;P&gt;Using the javascript API, I am lost!&lt;/P&gt;&lt;P&gt;Finding the full name based on user name in no problem but somehow, I cannot find a user name from the full name!&lt;/P&gt;&lt;P&gt;Thanking you in advance,&lt;/P&gt;&lt;P&gt;Pablo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;!I am using Alfresco 5.2!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Apr 2019 08:09:14 GMT</pubDate>
    <dc:creator>nimbus1958</dc:creator>
    <dc:date>2019-04-17T08:09:14Z</dc:date>
    <item>
      <title>Javascript - How to find the user name based on full name?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76001#M24082</link>
      <description>Hello,It may seems trivial but I cannot find the info!Using the javascript API, I am lost!Finding the full name based on user name in no problem but somehow, I cannot find a user name from the full name!Thanking you in advance,Pablo!I am using Alfresco 5.2!</description>
      <pubDate>Wed, 17 Apr 2019 08:09:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76001#M24082</guid>
      <dc:creator>nimbus1958</dc:creator>
      <dc:date>2019-04-17T08:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - How to find the user name based on full name?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76002#M24083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is not function available out-of-the-box to get the &lt;EM&gt;username&lt;/EM&gt; from the Full Name. In fact, Alfresco is not storing the Full Name, so you need to split the string into &lt;EM&gt;firstName&lt;/EM&gt; and &lt;EM&gt;secondName&lt;/EM&gt;. For example, for "Alice Beecher", first name is "Alice" and second name is "Beecher".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From this point, you need to use the search API. Something similar to following snippet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; results &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;BR /&gt;  search&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;query&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;query&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"cm:firstName:'Alice' AND cm:lastName:'Beecher'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Apr 2019 13:49:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76002#M24083</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2019-04-17T13:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - How to find the user name based on full name?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76003#M24084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have tried the following but with no results:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;"&gt;var&lt;/SPAN&gt; results &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; &lt;BR /&gt;&amp;nbsp; search&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #d74444; border: 0px; font-weight: inherit;"&gt;query&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;{&lt;/SPAN&gt;query&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;"cm:firstName:'Pablo' AND cm:lastName:'Severin'"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It gives me an error:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffe0e0;"&gt;0318127301 Failed to execute search: cm:firstName:'Pablo' AND cm:lastName:'Severin'&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2019 06:27:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76003#M24084</guid>
      <dc:creator>nimbus1958</dc:creator>
      <dc:date>2019-04-18T06:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - How to find the user name based on full name?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76004#M24085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have tried:&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;var results = search.query({query:"cm:firstName='Pablo' AND cm:lastName = 'Severin'"});&lt;BR /&gt;logger.log(results);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It returns empty but there is no error now!&lt;/P&gt;&lt;P&gt;I have also tried without the single quotes but it is also empty without errors!&lt;/P&gt;&lt;P&gt;Strange!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2019 07:36:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76004#M24085</guid>
      <dc:creator>nimbus1958</dc:creator>
      <dc:date>2019-04-18T07:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - How to find the user name based on full name?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76005#M24086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, if i'm not mistaken the query grammar is missing somenthig. If we agree we are writing the query in lucene language (if not, my mistake sorry) the right query will be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-java line-numbers"&gt;&lt;CODE&gt;@cm\&lt;SPAN class="operator token"&gt;:&lt;/SPAN&gt;firstName&lt;SPAN class="operator token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Pablo"&lt;/SPAN&gt; AND @cm\&lt;SPAN class="operator token"&gt;:&lt;/SPAN&gt;lastName&lt;SPAN class="operator token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Severin"&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And once you write it in your String you should escape&amp;nbsp;properly, something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-java line-numbers"&gt;&lt;CODE&gt;@cm\\&lt;SPAN class="operator token"&gt;:&lt;/SPAN&gt;firstName&lt;SPAN class="operator token"&gt;:&lt;/SPAN&gt;\"Pablo\" AND @cm\\&lt;SPAN class="operator token"&gt;:&lt;/SPAN&gt;lastName&lt;SPAN class="operator token"&gt;:&lt;/SPAN&gt;\"Severin\"&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hoping I was usefull&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Luca&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2019 08:06:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76005#M24086</guid>
      <dc:creator>luca_biondo</dc:creator>
      <dc:date>2019-04-18T08:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - How to find the user name based on full name?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76006#M24087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Luca, I have a node now!&lt;/P&gt;&lt;P&gt;Got to just find a way to get the userName from it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pablo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2019 08:16:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76006#M24087</guid>
      <dc:creator>nimbus1958</dc:creator>
      <dc:date>2019-04-18T08:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - How to find the user name based on full name?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76007#M24088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'r welcome &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, again, if I'm not mistaken, from first name and last name you would like to find the user name. Now you have a NodeRef object, if I were you i would&amp;nbsp;try to use the NodeService to get my property. Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-java line-numbers"&gt;&lt;CODE&gt;nodeService&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getProperty&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;nodeRef&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ContentModel&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;PROP_USER_USERNAME&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I only tried it, quickly, on the node browser so let me know if it works!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Luca&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2019 08:26:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76007#M24088</guid>
      <dc:creator>luca_biondo</dc:creator>
      <dc:date>2019-04-18T08:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - How to find the user name based on full name?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76008#M24089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No luck!&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;var results = search.query({query:"@cm\\:firstName:\"Pablo\" AND @cm\\:lastName:\"Severin\""});&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;returns:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #e2fdd2;"&gt;DEBUG - Node Type: {http://www.alfresco.org/model/content/1.0}person, Node Aspects: [{http://www.alfresco.org/model/application/1.0}configurable, {http://www.alfresco.org/model/system/1.0}cascadeUpdate, {http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/imap/1.0}imapPreferences, {http://www.alfresco.org/model/system/1.0}localized, {http://www.alfresco.org/model/content/1.0}preferences, {http://www.alfresco.org/model/remotecredentials/1.0}remoteCredentialsSystemContainer]&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The nodeService gives me an error!&lt;/P&gt;&lt;P&gt;I do not know what to do now!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pablo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2019 08:36:07 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76008#M24089</guid>
      <dc:creator>nimbus1958</dc:creator>
      <dc:date>2019-04-18T08:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - How to find the user name based on full name?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76009#M24090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use are using javascript. refer to the scriptNode API for getting the property:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;results[0].properties.userName;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2019 08:43:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76009#M24090</guid>
      <dc:creator>abbask01</dc:creator>
      <dc:date>2019-04-18T08:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - How to find the user name based on full name?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76010#M24091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Super!&lt;/P&gt;&lt;P&gt;It works! Thank you all for you help!&lt;/P&gt;&lt;P&gt;Pablo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2019 08:46:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/javascript-how-to-find-the-user-name-based-on-full-name/m-p/76010#M24091</guid>
      <dc:creator>nimbus1958</dc:creator>
      <dc:date>2019-04-18T08:46:52Z</dc:date>
    </item>
  </channel>
</rss>

