cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically manage a property of a custom aspect

joeforte
Champ in-the-making
Champ in-the-making
Hi, I'm a beginner about Alfresco and I have a question.
I created a model with the following custom aspect (the configuration of the property is not the definitive one):

<aspect name="gs:publishable">
         <title>Metadati sulle informazioni di pubblicazione</title>
         <properties>
            <property name="gs:ToBePublished">
               <type>d:boolean</type>
               <mandatory>true</mandatory>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>false</tokenised>
               </index>
            </property>
            <property name="gs:PublishDate">
               <type>d:date</type>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>false</stored>
                  <tokenised>both</tokenised>
               </index>
            </property>
            <property name="gs:UnpublishDate">
               <type>d:date</type>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>false</stored>
                  <tokenised>both</tokenised>
               </index>
            </property>
         </properties>
      </aspect>

As I said the configuration is not definitive because the requirement  I should implement is that PublishDate and UnpublishDate properties are read-only and managed by system as follows:

When a user edits a document and sets ToBePublished = True (False) automatically must be set (by the system, with a trigger, I do not know how …) PublishDate (UnublishDate) with the current date.
Does anyone have any suggestions?
Thanks in advance for your reply!
14 REPLIES 14

jpotts
World-Class Innovator
World-Class Innovator
Yes, that looks good, but I would strongly recommend changing the name of that aspect to something a little more descriptive and unique so that when you add other aspects to your model you'll be able to tell the difference between the two.

Jeff

joeforte
Champ in-the-making
Champ in-the-making
Yes, that looks good, but I would strongly recommend changing the name of that aspect to something a little more descriptive and unique so that when you add other aspects to your model you'll be able to tell the difference between the two.

Jeff

Any ideas on why the input parameters (before and after) come null to the script?

Here a topic that signals the same problem.

joeforte
Champ in-the-making
Champ in-the-making
Maybe it's a bug never resolved of 'community' version?

Meantime, I try to create the behavior in java to see if it works …

jpotts
World-Class Innovator
World-Class Innovator
I don't have any examples that use onUpdateProperties. I'll try this and see if I can reproduce it when I get a chance. Maybe you can try an onUpdateNode example (use the SomeCo HR Doc example I gave you or create your own) and see if that one works.

Jeff

jpotts
World-Class Innovator
World-Class Innovator
I have confirmed that the before and after args are coming back null from JavaScript behaviors. I've also checked Jira and found the following bug:
http://issues.alfresco.com/jira/browse/ALF-7506

The fix release is marked as Swift.

I'll add a comment with a link back to this thread.

Jeff