Book a Demo

Author Topic: Workflow scripts vs addin + attribute events  (Read 19594 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Workflow scripts vs addin + attribute events
« on: January 28, 2026, 09:10:55 pm »
Hi,

I'm looking at the Workflows scripts to implement control rules e.g. to prevent groups of users from creating or updating specific model content.
First of all, I noticed on the user guide that VBScript workflow scripts are deprecated i.e. add-ins are recommended. Am I right to understand Sparx suggests using Model-based addins ?

According to the "Functions - Validate and Control User Input" page, a script can be triggered with events such as before creating an element or a connector, or before updating a tagged value. For other updates on existing elements, it doesn't seem to be possible to trigger a control before updating an element's notes or name, or creating/deleting/updating an attribute. Is there a workaround with Workflow vbscripts or by switching to a model-based addin ?

I noticed that add-in events include EA_AllowPropertyUpdate which is not supported in the script but I'm not sure if it's related with an attribute update.
« Last Edit: January 28, 2026, 09:22:06 pm by Guillaume »
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: Workflow scripts vs addin + attribute events
« Reply #1 on: January 30, 2026, 12:01:13 am »
Hi

Now there's a throw back to past EA times!

As far as I remember the Workflow script were (are) very limited to the element properties that can be checked, and often these were not the ones that get changed!

I have used Model-based add-ins to validate element property (in my case the Name) changes using

EA_ContextItemChanged https://sparxsystems.com/enterprise_architect_user_guide/17.1/add-ins___scripting/ea_oncontextitemchanged.html
Here I make a note of the current property values

EA_OnNotifyContextItemModified https://sparxsystems.com/enterprise_architect_user_guide/17.1/add-ins___scripting/ea_onnotifycontextitemmodified.html
Here I validate if the changes are allowed, if not, then the properties are restored to the saved values.

You may have to experiment in the code on how to extract the data within the broadcast event parameter(s), they appear to be available via
Code: [Select]
Info.Get(0) where 0 is the first parameter etc. Alternatively something like:

Code: [Select]
var item = Repository.GetContextObject();

if (item == null)
{
Session.Output("No element found!");
return;
}

// Do we have an element
if (item.ElementGUID != null)


May work.

I am sure there are other methods to achieve what you are seeking.

Hope this helps

All the best

Phil
Models are great!
Correct models are even greater!