Book a Demo

Author Topic: Access to Repository Object from Workflow Script  (Read 5871 times)

Apnea

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Access to Repository Object from Workflow Script
« on: July 09, 2010, 05:46:57 pm »
Hi,

i am new to the workflow scripting engine. I am wondering how to access the repository from the workflow scripting engine. Is this possible, and if yes can someone provide me a code sample?
If it is not possible, is it possible to call a AddIn method from the workflow script as an "workaround"?
Any replies would be very helpful :)

Thanks

Dirk

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Access to Repository Object from Workflow Scri
« Reply #1 on: July 13, 2010, 08:44:30 am »
You can not access the repository from workflow scripts, this is to prevent all manner of badness.  The context is populated with properties of the current context and current user before being called.  If you don't think this is enough, maybe you should clarify what you need.
« Last Edit: July 13, 2010, 08:44:54 am by simonm »

Apnea

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Access to Repository Object from Workflow Scri
« Reply #2 on: July 13, 2010, 05:11:09 pm »
Dear Simon, yes it was helpful

i think there is  one way to get access to the repository: a GetObject call, but it lead to a timeout with in the workflow scripting :( but you can access the model, but i do NOT recmmend it ;)

I try to enforce life cylcles for an element. There might be different life cycles for different elements, e.g. requirements, classes, components etc. These life cycles shall be modeled within the model. To check which transition within the life cycle is allowed, my approach was to check it with an workflow script retrieving the data from the model. Is there  another approach?

Dirk

Paul Greefhorst

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Access to Repository Object from Workflow Scri
« Reply #3 on: March 07, 2011, 08:34:48 pm »
Hi,

I Also feel the need to access the repository; in my case I'm trying to set up a system in which features will be satisfied bij (linked) requiremens, which on their turn will be satisfied bij one or more classes (or other c# artefacts).
What I wat to acomplisch is that when an object is changed, all realisation-links will become 'suspicious'. So if a requirement is changed, the link to the feaures it realizes and the link to the classes that implements that requirement will be marked as suspicious.
Next thing that should be done, will be to verify which of those suspicious related objects need to be changed and which won't be influenced bij the original change.

Right now I have added a datetime stamp as tagged value to those links and I can compare this to te modfied date of the source en destination. However, just replacing an object to another package will also trigger the modified date.

Another way to get this working would be to write a trigger that after an opdate of an object could update the relations.

shaunf

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Access to Repository Object from Workflow Scri
« Reply #4 on: March 08, 2011, 04:02:29 am »
How do you get your workflow scripts to be called when i add the broadcast events to a workflow script nothing happends i guess im doing something wrong.

And i think the repository isnt allowed to stop malicious code as anyone can set a workflow script. Just not anyone can turn them off. What seems strange from our testing here.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Access to Repository Object from Workflow Scri
« Reply #5 on: March 08, 2011, 08:37:38 am »
Paul, you can do what you are wanting by writing an add-in and handling the context item modified event.

Shaun, do you have security enabled?  Workflow scripts work based on the security user and groups.

Paul Greefhorst

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Access to Repository Object from Workflow Scri
« Reply #6 on: March 08, 2011, 08:03:42 pm »
Simon,

Thanx for your reply. It indeed what I have been working on last weekend.
There is however a dis-advantage of using this event. I don't have the the 'oldvalue' to compare with, unless you are giving me a great hint on how to accomplisch this.
I need this oldvalue since a status change from 'approved' to 'to do' should make all related items suspicious, wile a status change from 'test' to 'approved' should not. This is why I was looking into the workflow functionaliteit.

Do you have a suggestion? Can I acces the audittrail to obtain old values?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Access to Repository Object from Workflow Scri
« Reply #7 on: March 09, 2011, 08:26:16 am »
You should always get a EA_OnContextItemChanged notification before EA_OnNotifyContextItemModified. I would try storing the status (and guid just in case) from the first and checking it against the second.