Possible to define the default value as the current date?
4 answers
One of the attributes I have for one of my Requirement Types (Attribute Groups) is "Date added". The type of this attribute is "Date".
I would like to make the default value of this attribute the "current date". Is it possible?
Thank you
Default dates can be set but I am not aware of way to use "current" date.
Now we do store the date the artifact was created, and the date it was last modified, and in the artifact history you can see the date and time there are any content, attribute, or comment changes.
If this is still not enough then I suggest raising a enhancement request.
Enhancement Request submited.
Thanks for the response.
Eduardo
Default dates can be set but I am not aware of way to use "current" date.
Now we do store the date the artifact was created, and the date it was last modified, and in the artifact history you can see the date and time there are any content, attribute, or comment changes.
If this is still not enough then I suggest raising a enhancement request.
Thanks for the response.
Eduardo
One of the attributes I have for one of my Requirement Types (Attribute Groups) is "Date added". The type of this attribute is "Date".
I would like to make the default value of this attribute the "current date". Is it possible?
Thank you
Default dates can be set but I am not aware of way to use "current" date.
Now we do store the date the artifact was created, and the date it was last modified, and in the artifact history you can see the date and time there are any content, attribute, or comment changes.
If this is still not enough then I suggest raising a enhancement request.
Hi Eduardo,
I have created a custom attribute "to_date" of type Time Stamp. i added the script below to get default value as Current date for "to_date" attribute. It's working for me.
Hope this solves ur requirement.
dojo.provide("com.example.date");
dojo.require("dojo.date"); // We need the date class from Dojo to compare two dates
dojo.require("dojo.date.stamp"); // We need the stamp class to work with ISO date strings
(function() {
dojo.declare("com.example.date", null, {
getDefaultValue: function(attribute, workItem, configuration) {
var now=new Date();
var date= dojo.date.stamp.toISOString(now, {milliseconds:true, zulu:true});
console.log("Now is: " + date);
return date;
}
});
})();
I have created a custom attribute "to_date" of type Time Stamp. i added the script below to get default value as Current date for "to_date" attribute. It's working for me.
Hope this solves ur requirement.
dojo.provide("com.example.date");
dojo.require("dojo.date"); // We need the date class from Dojo to compare two dates
dojo.require("dojo.date.stamp"); // We need the stamp class to work with ISO date strings
(function() {
dojo.declare("com.example.date", null, {
getDefaultValue: function(attribute, workItem, configuration) {
var now=new Date();
var date= dojo.date.stamp.toISOString(now, {milliseconds:true, zulu:true});
console.log("Now is: " + date);
return date;
}
});
})();
Follow this link, u should be able to run the scripts.
https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Conditions
Note: Don't forget to implement below step, without this java scripts can't be run.
https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Conditions
Note: Don't forget to implement below step, without this java scripts can't be run.
To use scripts deployed as process attachments you need to enable this functionality:
-
Go to administrative page of your RTC server
https://your.server.name:9443/ccm/admin
. - Open the Server tab.
- From the left side-bar open Configuration > Advanced Properties
-
In the Work Item Component find the Enable Process Attachment Scripts property and set its value to
true
.