How do I create a rule that inserts the current date into an attribute of type date?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

How do I create a rule that inserts the current date into an attribute of type date?

 I tried to create a rule, as in the figure below, 
but I do not know what to put in the field for the attribute 
to receive the current date every time it enters a folder.


1 Reply
Highlighted
Senior Member II

Re: How do I create a rule that inserts the current date into an attribute of type date?

I use the option "execute script" for the rule.

If the document already has the property you want to set to "today", let's say it is dms:today which has type date:

document.properties["dms:today"]=new Date();
document.save();‍‍

not sure if document.save() is really needed.

If you have to add a custom aspect called "dms:yourAspect" and set the date:

var props=new Array();
props["dms:today"]=new Date();

document.addAspect("dms:yourAspect", props);

The script has to reside in the Data Dictionary in subfolder scripts.