Book a Demo

Author Topic: Change values in workflow script  (Read 5298 times)

jörg

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Change values in workflow script
« 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:
Quote
Timeout invoking script   
AllowStatusUpdate("Implemented","Mandatory")   

Is there any way to achieve my goal?
« Last Edit: September 06, 2018, 02:24:31 am by jörg »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13510
  • Karma: +573/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Change values in workflow script
« Reply #1 on: September 06, 2018, 02:19:04 pm »
Is there any way to achieve my goal?

Write an add-in I suppose ( or use EA-Matic )

Geert

jörg

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Change values in workflow script
« Reply #2 on: September 07, 2018, 05:21:37 pm »
With other words: No?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13510
  • Karma: +573/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Change values in workflow script
« Reply #3 on: September 07, 2018, 06:35:30 pm »
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

jörg

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Change values in workflow script
« Reply #4 on: September 07, 2018, 10:29:44 pm »
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/) 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.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13510
  • Karma: +573/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Change values in workflow script
« Reply #5 on: September 08, 2018, 01:40:43 am »
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

jörg

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Change values in workflow script
« Reply #6 on: September 08, 2018, 06:31:32 am »
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
« Last Edit: September 08, 2018, 06:35:03 am by jörg »

jörg

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Change values in workflow script
« Reply #7 on: October 09, 2018, 09:39:21 pm »
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.