It's all about the answers!

Ask a question

Get Action time stamp in calculated value?


Cesar Sasaki (511285124) | asked Aug 14 '14, 6:49 p.m.
Hi

I want to get the timestamp when an action occurs in RTC. I have done some scripts with the calculated value, but not one that gets updated everytime they pass from example from State1 to State 2.
Can I get that?

Thanks

One answer



permanent link
Ralph Schoon (63.1k33645) | answered Aug 15 '14, 3:00 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Cesar,

dealing with state changes in JavaScript is problematic.

It would be interesting what do you want to achieve here. Which version of RTC do you use?

There are numerous issues here. https://jazz.net/wiki/bin/view/Main/AttributeCustomization shows that you can only detect the state you are in. The action is only available in conditions and, since it has not happened yet, not very useful either.

You can not detect a state change is about to happen, or has happened.
The only way I think you could try to do what you want is to store the current state in a hidden attribute. You can not act on the save. You would have to detect that a state change has happened and then copy the modification date into the attribute.

Dependent on what you want to achieve, you might be better off, using a server follow up action extension.

Comments
Cesar Sasaki commented Aug 15 '14, 10:36 a.m.

Hi Ralph
First thanks for answering my question.
I'm using RTC 4.0.6.
What I want to achieve is store in hidden attributes the last date(timestamp) of a certain action (I say last because an action can be done several times , like a reopen).
I have achieved that i store in a hidden attribute the first date when the workitem gets to an state.But its only the first date. Because when I tried to make a script that updates whenever it gets to the same state , it also saved the date when I modified something on that state.

How can I stored the previous state in a hidden ?Because  I think that the work item actually runs the script twice (when you click  the action and when you click save I think).

Thanks!



Ralph Schoon commented Aug 15 '14, 10:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You can only save the state (from the attribute state) you have access to. If you do that, I think you should be able to detect that the current state is not equal to the state value in the attribute. Only in this case you know a change has been done and can act upon it. If the current state equals the attribute value you would not know what is going on and also not provide the attribute value, or rather pass the old value of the attribute.

Yes, calculated value providers run multiple times, to act upon changes to the values they depend on.


Jonas Studer commented Aug 19 '14, 5:00 a.m.

Hy Ralph, Hy Cesar,

I might have a little Idea.
I've made a "Set Done"-Button in a widget I created.
There we could direct see, which state a WorkItem is.
And I would say, you should simply store it as a String.
i.E. date;state --> 01:01:2014:00:00:00;open
just use string.slice(";");
Et voila you have your two values.

//This is how I get to the state of a workitem
//this.currentId is the ID of the specifiv workitem
this.workingCopyProxy = WorkItemProxyFactory.getWorkItemProxy({id: this.currentId, createIfNeeded: true, doNotCache: true, doNotGetFromCache:true});
this.workingCopyProxy.initialize({});

var proxyState = this.workingCopyProxy.getValue({path: 'attributes.internalState.label'});
proxyState == 'Done'

Your answer


Register or 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.