Workflow Script Functions

Workflow scripts are executed by the Enterprise Architect workflow engine, to manage user input. You write the scripts in the Scripter window, in VBScript, under the Workflow group type.

Note:

If you make changes to a workflow script listed in the Scripter window, click on the Refresh Scripts button in the Scripter window toolbar to reload the script with the changes.

Functions Enterprise Architect Calls to Validate and Control User Input

For each of the following functions that Enterprise Architect calls, a set of objects are filled.

Function

Use to...

Return Value

AllowPhaseUpdate(OldValue, NewValue)

Validate a change a user has made to a phase.

 

  • True to allow this user to make this change.
  • False to disallow the change and revert to the previous value.

AllowStatusUpdate(OldValue, NewValue)

Validate a change a user has made to a status.

AllowTagUpdate(TagName, OldValue, NewValue)

Validate a change a user has made to a Tagged Value.

AllowVersionUpdate(OldValue, NewValue)

Validate a change a user has made to a version.

CanEditPhase()

Enable or disable the control for editing a phase.

 

  • True to allow this user to make changes by enabling the control.
  • False to completely disable edit of this property by disabling the control.

CanEditStatus()

Enable or disable the control for editing a status.

CanEditTag(TagName)

Enable or disable the control for editing a Tagged Value.

CanEditVersion()

Enable or disable the control for editing a version.

PreAllowPhaseUpdate(OldValue, NewValue)

 

Determine what information is required to validate this change.

 

Semi-colon separated list of additional data required in order to validate this change.  See the list of supported data types.

PreAllowStatusUpdate(OldValue, NewValue)

PreAllowTagUpdate(TagName, OldValue, NewValue)

PreAllowVersionUpdate(OldValue, NewValue)

Functions Enterprise Architect Calls to Create a Search With User Tasks

Function

Use to...

Return Value

GetWorkflowTasks

Describe the searches that this user must run.

Ignored

Supported Data Types

Tests - fill the Tests array in the WorkflowContext object.

Workflow Data Structures - Objects Enterprise Architect Fills

WorkflowUser

This object provides information about the user currently logged in to the model. It is filled by Enterprise Architect before any function is called by Enterprise Architect. It has the following properties:

  • Username - the username for login to the system (if using Windows Authentication, this matches the Windows username)
  • Firstname - as found in the Security Users dialog
  • Surname - as found in the Security Users dialog
  • Fullname - the combination <Firstname> <Surname> (the form Enterprise Architect uses for Author fields and similar).

This object also calls the following function:

Function

Use to...

Return Value

IsMemberOf(GroupName)

Check group membership of the current user.

True if the current user is a member of the group with the specified name.

WorkflowContext

This object provides information about the object currently in context. It is filled by Enterprise Architect before any searches except GetWorkflowTasks are run. It has the following properties:

  • MetaType - the type of the current object, either an Enterprise Architect core type or a profile-specified metatype
  • Name - as found in the object Properties dialog
  • Status - as found in the object Properties dialog
  • Phase - as found in the object Properties dialog
  • Version - as found in the object Properties dialog
  • Stereotypes - an array of strings for the stereotypes applied to this object
  • Tags - an array of Tagged Values, providing:
  • Name - the Tagged Value name
  • Value - the Tagged Value value
  • Tests - an array of tests; only filled during an Allow* call after the PreAllow* call has specified that tests are required.  Provides the following details, as found in the Testing window:
  • Name
  • Status
  • RunBy
  • CheckedBy
  • TestClass
  • TestType

The WorkflowContext object also calls the following function:

Function

Use to...

Return Value

TagValue(TagName)

Get the value from a named tag.

Returns the value of the first Tagged Value with that name, or an empty string if no Tagged Value with that name exists.

Workflow Data Structures - Objects You Can Fill

WorkflowStatus

Use this to provide information on the status of the object.

  • LogEntry - set to True or False, to indicate whether a log item should be recorded
  • Reason - indicate what reason should be recorded in the log
  • Action - indicate how to display the log message; valid values are: MessageBox, StatusBar, Output (default).

WorkflowSearches

Provides an array of searches. Use Redim WorkflowSearches(x) to specify the number of searches being provided. Each search has the following attributes:

  • Name - the name of this search
  • Group - the name of the group that this search should appear under in the Search combo box
  • ID - the unique GUID for this search
  • Tasks - the array of tasks that this search looks for; an entry describes how to find all objects required to meet a particular task:
  • Name - the name of the task, as displayed in the Search view; workflow searches are grouped by this field by default
  • Conditions - an array of conditions, all of which must be matched for an object to be included in this task; a condition is a comparison of a single field to a value:
  • Column - the name of the field
  • Operator - operator types, either = (provide matching values only) or <> (provide non-matching values only)
  • Value - if this contains a comma, the string is treated as a comma separated list of values to compare against; otherwise the string is a single value to compare against.

Functions Enterprise Architect Provides For You to Call

Enterprise Architect provides the subfunction SetLastError( message, outputMethod ) for you to call, to log and/or report the provided message to the user.

You can also call the following functions:

Function

Use to...

Return Value

NewSearch(name, group, guid, taskcount)

Create a new search object to be included in WorkflowSearches. Initializes each member.

The created search.

NewTask(name, conditioncount)

Create a new task object to be included in a search. Initializes each member.

The created task.

NewCondition(column, operator, value)

Create a new condition object to be included in a task. Initializes each member.

The created condition.