Automatically manage a property of a custom aspect

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2011 07:01 AM
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):
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!
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!
Labels:
- Labels:
-
Archive
14 REPLIES 14
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2011 04:04 AM
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
Jeff

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2011 08:03 AM
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.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2011 09:03 AM
Maybe it's a bug never resolved of 'community' version?
Meantime, I try to create the behavior in java to see if it works …
Meantime, I try to create the behavior in java to see if it works …
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2011 09:25 AM
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
Jeff
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2011 12:36 PM
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
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
