<?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 Re: Save a document property value with a javascript value in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/save-a-document-property-value-with-a-javascript-value/m-p/325165#M12166</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The best option is to use the Automation JS client to directly call an update operation on the server side.
This is what is done in the new Select2 based widgets.&lt;/P&gt;
&lt;P&gt;In your case, you should already have access to JS Automation Client inside the global context.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt; var options = {automationParams : {
       params : {},
       context : {},
       input : { 'doc:' + window.ctx.currentDocument}       
   }}
var op = jQuery().automation("Document.SetProperty", options);
op.addParameter("xpath", propertyXPath);
op.addParameter("value", propertyValue);
op.execute();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will update the Document inside the repository.
If you want a better integration with JSF/Seam, you may want to define a Chain that will do the update + trigger a refresh in Seam.&lt;/P&gt;
&lt;P&gt;Tiry&lt;/P&gt;</description>
    <pubDate>Mon, 30 Sep 2013 10:53:08 GMT</pubDate>
    <dc:creator>Thierry_Delprat</dc:creator>
    <dc:date>2013-09-30T10:53:08Z</dc:date>
    <item>
      <title>Save a document property value with a javascript value</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/save-a-document-property-value-with-a-javascript-value/m-p/325164#M12165</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I want to save a property value getted by javascript (a facebook access token given by the facebook login process) to the current document viewed.
The document is in VIEW mode for this login action so i can't use the regular process for saving the current document.&lt;/P&gt;
&lt;P&gt;Technically, i'm on a Template widget of the property in VIEW mode and i have a javascript variable with my value.
How can i put the javascript value into the property value of the document and how i save it after ? (ajax ?)&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2013 11:02:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/save-a-document-property-value-with-a-javascript-value/m-p/325164#M12165</guid>
      <dc:creator>Smart_amp_Soft_</dc:creator>
      <dc:date>2013-09-25T11:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Save a document property value with a javascript value</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/save-a-document-property-value-with-a-javascript-value/m-p/325165#M12166</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The best option is to use the Automation JS client to directly call an update operation on the server side.
This is what is done in the new Select2 based widgets.&lt;/P&gt;
&lt;P&gt;In your case, you should already have access to JS Automation Client inside the global context.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt; var options = {automationParams : {
       params : {},
       context : {},
       input : { 'doc:' + window.ctx.currentDocument}       
   }}
var op = jQuery().automation("Document.SetProperty", options);
op.addParameter("xpath", propertyXPath);
op.addParameter("value", propertyValue);
op.execute();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will update the Document inside the repository.
If you want a better integration with JSF/Seam, you may want to define a Chain that will do the update + trigger a refresh in Seam.&lt;/P&gt;
&lt;P&gt;Tiry&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2013 10:53:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/save-a-document-property-value-with-a-javascript-value/m-p/325165#M12166</guid>
      <dc:creator>Thierry_Delprat</dc:creator>
      <dc:date>2013-09-30T10:53:08Z</dc:date>
    </item>
  </channel>
</rss>

