It's all about the answers!

Ask a question

resetting a variable in EWM(RTC)

jim Stevens (127) | asked Sep 02 '22, 3:41 p.m.


Is it possible to Clear a required variable when the state is changed.
A defect has a variable set to good because it was required on creation. Then the state changes from open to In Progress and we want to clear the variable with the value of good and require the person to select a new value.
Is this possible with Java script?

thank you 

One answer

permanent link
Ralph Schoon (62.7k33643) | answered Sep 12 '22, 4:15 a.m.

 The JavaScript API, unfortunately does not provide a good mechanism to detect a state change. It might be possible to implement something using custom attributes and a calculated value to store the current state and use that to detect the state change to determine when to set the custom attribute value. 

It is possible to write a server extension (called a follow-up action or participant) that detects the state change and changes the attribute value, but this would be performed after the state change and not in the UI. It would not really work, if the attribute value is required, because the precondition would prevent setting the value. 

I do not see a good approach to achieve that and I do not think it is a good idea to implement such a workflow. I would consider to use two attributes to implement such a business logic.    

Your answer

Register or to post your answer.