It's all about the answers!

Ask a question

How can I get the old state and new state use javascript in calculated value


haizi wu (6053948) | asked Nov 21 '12, 4:59 a.m.
edited Mar 21 '13, 12:28 p.m. by Ralph Schoon (57.1k23642)
 How can I get the old state and new state use javascript in calculated value?

One answer



permanent link
Ralph Schoon (57.1k23642) | answered Nov 21 '12, 7:51 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Haizi,

the answer as of my knowledge today is, you can only access the current state value. See: https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Accessing_built_in_attributes_of . There is no way to know the state or the action that ran. There is no trivial way to detect a state change in java script I am aware of.

By the way, this question has been asked and answered in this forum several times in the past already. Answers should be relatively easy to find using a search engine or the forum or site search.

Comments
1
Ralph Schoon commented Mar 21 '13, 12:28 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

It is still not possible to get the ID of the old state. However, in 4.x you can access the action that was used in conditions. See https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript

since 4.0 M1 getWorkflowAction() returns a string that is the id of a workflow action currently selected by the user. This action will be executed when the item is saved. If the user has not selected any action this method will return null . Note: This method works only when used inside a Condition script, the return value will always be null when this is used in other customization script types.


Your answer


Register or to post your answer.