<?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: How to access a document schema date parameter from Automation Chains in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328416#M15417</link>
    <description>&lt;P&gt;SimpleDateFormat("yyyy-MM-dd").format(date) need a Date in parameter and not a Calendar, sorry.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2012 17:13:19 GMT</pubDate>
    <dc:creator>Clément_Lardeur</dc:creator>
    <dc:date>2012-01-20T17:13:19Z</dc:date>
    <item>
      <title>How to access a document schema date parameter from Automation Chains</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328411#M15412</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I was trying to adapt the nuxeo studio template for Holiday request and have problem to find the correct syntax for the following:&lt;/P&gt;
&lt;P&gt;My document has a customised schema which include two properties with "Date" type.&lt;/P&gt;
&lt;P&gt;In my automation chain I want to send a Notification -&amp;gt; Send E mail and ton include those "date" inforamtion.&lt;/P&gt;
&lt;P&gt;For the moment, in my mail "message" part, I have used the following syntax:
@{Document["SchemaName:date_start"]}&lt;/P&gt;
&lt;P&gt;As a result I receive an email with the following (in addition to the reset of the e mail which is OK):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;java.util.GregorianCalendar[time=1326668400000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Paris",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2012,MONTH=0,WEEK_OF_YEAR=3,WEEK_OF_MONTH=3,DAY_OF_MONTH=16,DAY_OF_YEAR=16,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=0] 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Question is: how to display the date in readable format ??&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;PS: I looked in the documentation but all the examples I found are concerning "CurrentDate" but never for a parameter that belong to a Document schema.&lt;/P&gt;
&lt;P&gt;Snarf&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2012 14:55:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328411#M15412</guid>
      <dc:creator>snarf77_</dc:creator>
      <dc:date>2012-01-20T14:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to access a document schema date parameter from Automation Chains</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328412#M15413</link>
      <description>&lt;P&gt;Not tested but maybe you can try :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@{new java.text.SimpleDateFormat("yyyy-MM-dd").format(Document["SchemaName:date_start"].getTime())}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Jan 2012 15:24:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328412#M15413</guid>
      <dc:creator>Clément_Lardeur</dc:creator>
      <dc:date>2012-01-20T15:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to access a document schema date parameter from Automation Chains</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328413#M15414</link>
      <description>&lt;P&gt;When using SendMail operation it is easier if you use a message template instead of putting the mail content directly in the "message" argument.
Using a mail template enable you to use freemarker and reuse your message in other operations.
So create a new Mail Template and link it to the message attribute in your operation (click on the button at the right of the textarea)
Then in your mail template you can write this for example:&lt;/P&gt;
&lt;P&gt;${Document['dc:modified']?string.full}&lt;/P&gt;
&lt;P&gt;This will print the dc:modified date of the document attached to the mail. The ?string.full method is a freemarker method that format the date.
You can look here for more formatting options:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://freemarker.sourceforge.net/docs/ref_builtins_date.html" target="test_blank"&gt;http://freemarker.sourceforge.net/docs/ref_builtins_date.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2012 15:44:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328413#M15414</guid>
      <dc:creator>bstefanescu_</dc:creator>
      <dc:date>2012-01-20T15:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to access a document schema date parameter from Automation Chains</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328414#M15415</link>
      <description>&lt;P&gt;Thanks Clément and bstefanescu&lt;/P&gt;
&lt;P&gt;Clément, I tried your method but get a error message concerning the format (I didn't catch it in time)&lt;/P&gt;
&lt;P&gt;bstefanescu, your method return me the following error when running the automation chain:&lt;/P&gt;
&lt;P&gt;error occured while executing the chain 'ChainBonConges': Expected hash. Document['SchBonConges:date_start']?string evaluated instead to freemarker.core.BuiltIn$stringBI$BooleanFormatter on line 5, column 30 in @inline.
Transaction failed&lt;/P&gt;
&lt;P&gt;The difference with your recommendation is that I need to access a date that in my schema not dubin core one. I don't know if this make a difference or not so I tried replacing dc:modified by my schema name and properties.&lt;/P&gt;
&lt;P&gt;Any guess ??&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2012 17:06:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328414#M15415</guid>
      <dc:creator>snarf77_</dc:creator>
      <dc:date>2012-01-20T17:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to access a document schema date parameter from Automation Chains</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328415#M15416</link>
      <description>&lt;P&gt;Can you add the full stack trace?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2012 17:12:22 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328415#M15416</guid>
      <dc:creator>bstefanescu_</dc:creator>
      <dc:date>2012-01-20T17:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to access a document schema date parameter from Automation Chains</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328416#M15417</link>
      <description>&lt;P&gt;SimpleDateFormat("yyyy-MM-dd").format(date) need a Date in parameter and not a Calendar, sorry.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2012 17:13:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328416#M15417</guid>
      <dc:creator>Clément_Lardeur</dc:creator>
      <dc:date>2012-01-20T17:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to access a document schema date parameter from Automation Chains</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328417#M15418</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Another (tested succesfuly) solution is to use the Scripting function provided for handling date obejcts:&lt;/P&gt;
&lt;P&gt;For instance, the following sequence will update the description field with the date value of the dc:modified property:&lt;/P&gt;
&lt;P&gt;Fetch &amp;gt; Context Document
Document &amp;gt; Update Property ((value: @{Fn.calendar(Document["dc:created"]).format("yyyy-MM-dd")}),(xpath:dc:description))&lt;/P&gt;
&lt;P&gt;In case of writing the email in an ftl template, you can set the value you want to use as a context variable before calling the SendEmail operation, and then access the value you computed before in the Context object&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2012 17:34:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328417#M15418</guid>
      <dc:creator>Alain_ESCAFFRE</dc:creator>
      <dc:date>2012-01-20T17:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to access a document schema date parameter from Automation Chains</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328418#M15419</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I did two things and now it's working so I don't know which one among those are required...&lt;/P&gt;
&lt;P&gt;Both actions are:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;replacing '  par "&lt;/LI&gt;
&lt;LI&gt;deleting the ?string.full&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;My final working syntax is the following:
Document["SchBonConges:date_start"]&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2012 18:03:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-access-a-document-schema-date-parameter-from-automation/m-p/328418#M15419</guid>
      <dc:creator>snarf77_</dc:creator>
      <dc:date>2012-01-20T18:03:35Z</dc:date>
    </item>
  </channel>
</rss>

