cancel
Showing results for 
Search instead for 
Did you mean: 

setting datetime aspect properties in rule action

jim_van_dam
Champ in-the-making
Champ in-the-making

Are aspect datetime custom properties supported for the 'set property' rule action?

We created an aspect with different properties and all show up when creating 'set property' rule actions except the d:datetime properties.

We are using Alfresco community edition.

If not supported we understand that we can create a custom action, but we want to make sure this cannot be achieved without custom coding.

1 ACCEPTED ANSWER

cesarista
World-Class Innovator
World-Class Innovator

Jeff Potts, I have the same issue for example with default effectivity aspect (in older Alfresco 201602GA), and the cm:from and cm:to properties.

Jim van Dam‌, try to define the rule and run a script (with Alfresco Javascript API - it is server API) saved in /Data Dictionary/Scripts/ that sets the corresponding property.

Regards.

--C.

View answer in original post

6 REPLIES 6

cesarista
World-Class Innovator
World-Class Innovator

Try to set property on a document, using ISO8601 format for datetimes in the Javascript Console for example.

Regards.

--C.

Hi Cesar, can you elaborate on that?

As we are talking about an action in a rule with the condition "a document entering a folder" I expect this to be run on the back-end and not client side. Some documents are put in folders through CMIS API.

The solution we are looking for is being able to set the datetime property as a rule action on a folder.

Regards,

Jim

jpotts
World-Class Innovator
World-Class Innovator

Write a JavaScript file with something like:

document.properties['tst:datetime1'] = new Date(); // Or whatever

document.save();

That JavaScript file is then uploaded to Data Dictionary/Scripts.

Now in your folder rule, use the "execute script" action and point to the script you just uploaded.

Because it is in a rule it will be fired regardless of how the content is added to the repo, including via CMIS.

jpotts
World-Class Innovator
World-Class Innovator

This looks like a bug. I have reproduced the problem on my machine with 201702-GA 5.2.0 (r135134-b14) schema 10005.

The steps to reproduce were to use the Model Manager to create a new namespace and aspect. The aspect has a single datetime property and the default layout has been applied.

Adding the aspect to documents and editing the property as normal works fine.

The problem is that when configuring a rule, the set property action shows the aspect under "Aspects" but when you click it, it offers no properties to set.

Can you please create a Jira and reference this forum thread?

cesarista
World-Class Innovator
World-Class Innovator

Jeff Potts, I have the same issue for example with default effectivity aspect (in older Alfresco 201602GA), and the cm:from and cm:to properties.

Jim van Dam‌, try to define the rule and run a script (with Alfresco Javascript API - it is server API) saved in /Data Dictionary/Scripts/ that sets the corresponding property.

Regards.

--C.

jim_van_dam
Champ in-the-making
Champ in-the-making

Cesar Capillas‌ thanks for the tips, I will see how quick the bug is fixed 🙂 and otherwise use your solution to proceed.

Jeff Potts‌ thank you for reproducing. I will create a ticket for it. If bug fixes are as quickly taken up as answers to questions I would be very impressed...

Created ticket: [ALF-21884] datetime property cannot be set using 'set property' action in rule - Alfresco JIRA