Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Possible to define the default value as the current date?

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

0 votes



4 answers

Permanent link
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.

0 votes

Comments

Hi Robin,

Can u share the procedure for how to set default date for attribute "to_date" of type time stamp.


Permanent link
Enhancement Request submited.

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.

0 votes


Permanent link
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;       

        }

    });

})();

0 votes

Comments

Interesting, but where do you add this script to? It looks like a javascript to me, but where do I add it to?

thanks


Permanent link
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.

To use scripts deployed as process attachments you need to enable this functionality:

  1. Go to administrative page of your RTC server https://your.server.name:9443/ccm/admin .
  2. Open the Server tab.
  3. From the left side-bar open Configuration > Advanced Properties
  4. In the Work Item Component find the Enable Process Attachment Scripts property and set its value to true .


0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Feb 15 '11, 6:54 a.m.

Question was seen: 5,341 times

Last updated: Jul 19 '12, 9:19 a.m.

Confirmation Cancel Confirm