How can I get the old state and new state use javascript in calculated value
One answer
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.
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
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 M1getWorkflowAction()
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 returnnull
. Note: This method works only when used inside a Condition script, the return value will always benull
when this is used in other customization script types.
1 vote