Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: jörg on September 06, 2018, 02:20:04 am
-
As said in the title I would like to change item values in a workflow script. More exactly, I want to automatically increase the version of a requirement if a specific user (or a member of a specific group) changes the status to 'Approved'.
Unfortunately I seem not to have access to any repository items (Repository object) in a workflow script. I managed to change the Version of the current selected element in a script in the 'Normal' group by calling the script in the scripting console.
When I include the script in my workflow script, it tells me (in the System Output window) that the variable 'Reposotory' is not defined.
Even if I try to call it using the App-object (GetObject(,"EA.App") and get App.Repository object; I know it is marked as read only) just makes the Application freeze for a while and finally doesn't change the version but gives a message:
Timeout invoking script
AllowStatusUpdate("Implemented","Mandatory")
Is there any way to achieve my goal?
-
Is there any way to achieve my goal?
Write an add-in I suppose ( or use EA-Matic )
Geert
-
With other words: No?
-
With other words: No?
No, there is a way. It might not be your preferred way (workflow scripts), but it is possible to do what you would like using either an add-in or an EA-Matic script.
It seems like workflow scripts are is of these areas in EA that is rarely used. Possibly because of some of the limitations you are encountering as well.
Geert
-
Thanks to your help (here and on your page https://bellekens.com/2011/01/29/tutorial-create-your-first-c-enterprise-architect-addin-in-10-minutes/ (https://bellekens.com/2011/01/29/tutorial-create-your-first-c-enterprise-architect-addin-in-10-minutes/)) I managed to create a simple addin in C#.
Now I'm looking for the appropriate event to get notified when a user changes the status of an item. The only ones I found were "EA_OnOutputItemClicked" and "EA_OnOutputItemDoubleClicked", but the information about these are very rare. Is one of these Event functions the right one for my purpose? And, if you could be so kind (and patient :) ), could you give me a hint how to proceed?
I cloned your Framework from Github, but at the first view I didn't find the part that could help me here, although it seems to be helpful in a later stage of my pursuit to make requirements engineering more secure in EA.
Thanks again till here!
P.S.: Since I have to go to holidays today :'( ;) it might take a while until I will be able to proceed with my task. So please dont be angry if I don't answer for a while.
-
Hi Jörg,
Have a look at the context item events.
In the contextItemchanged event you'll have to remember the element and it's status (the before).
The contextItemModified will be executed when an element is being saved.
In that event you'll have to compare the stored status with the current status.
Enjoy your holidays :)
Geert
-
Hi Geert,
thanks again to you, for your helpful hint and for your wishes to me. After some searching I got it to find the description of these events. Indeed I managed to overlook the whole broadcast event chapter before :-[
But now I know how I will proceed after my holidays and I can enjoy them better. THX! 8)
Jörg
-
Hi Geert,
with your support I managed to implement my addin using VisualStudio and C#. Thanks a lot, I've learned a lot from this.