Document numberRevision
DOCU1242112

 

Advanced schema and customization in Highstage

Advanced schema and customization in HighstageIntroductionScopeAdd a new database column for itemsAdd column to typeExtend the length of an existing database column<type name="_file" and <refinery name="file>" elements<feature name="config-manager"> elementSamplesThe following sample enables the Change-undo button:<feature name="reference-manager"> elementAvailable elements and attributes<profile> elementDefault configurationsSamplesRun script on Item changeReset column values on item change (change to Working state)First Article Inspection (FAI)Note field for adding user commentsUsing database columnUsing EventlogVirtual columnsVirtual column as alias to physical columnVirtual column with SQL selectDisplay parent descriptionDispaly age using sql datediffMailsSend mail from custom codeEventlogInsert event into Eventlog by custom codeReferencesUsing (ref-type) element to specify grid-columns for specific child typeAbility to expand references (+/-) in search grid for special typesReference filter and refilterRolesTrustees on rolesPlace specific subtype in specific workspaceForm title customizationCustom.schema.xmlCode behindAdvanced detailed menu and main page permissionsCreate automationSpecify suppliers in create form and add references on createRefineryDisable pdf file creation in Excel refineDisable refine on Excel filesAdd properties directly in schema without codeFolder refineItem change permissionsMoving subforms using x-index and y-indexSampleMake a grid column narrowShow image/picture from item folder on web page


Introduction

This article will help you get started with changing behavior or add custom functionality to Highstage through schema configuration.

Please note that potential changes to the custom XML schemas can cause errors resulting in potential downtime of Highstage. Thus, consider using a designated test server during development, and implement modifications on the production server out of business hours.

 

Scope

This article serves both Highstage clients and personnel.

 

Add a new database column for items

Here, you will be introduced to the procedure of adding a new database column to an exiting type/table.

 

Add column to type

In custom.schema.xml add the column definition to a specific type, for example, doc type:

Observe that part type inherits from doc type, so the new column will also be available in part type.

 

Extend the length of an existing database column

In some situations, it may be required to extend column length.

This may be done directly in the database by using SQL management studio, or by the schema. Changing column length or type may require unchecking Prevent saving changes that require table re-creation.

This can be disabled by navigating to Tools>Option>Designers:

manager-settings

 

The following describes how to extend the Author column by the schema.

To find the name of the physical database column, run as SuperUser (or higher) and click on the grid or form title:

author-grid

 

The physical column appears as editby:

physical-column

 

Change custom.schema.xml to extend the column length, for example to 512 bytes:

 

The length of a physical database column will be extended to match the schema definition by running Apply schema web page.

 

You can apply the schema changes by navigating to SYSTEM > SCHEMA > APPLY from the Highstage side navigation menu with SuperUser/AdminRead/AdminWrite user level enabled.

 

This approach using schema can only be used to extend column length. It cannot be used to shorten the length or to change the type of a physical database column. To shorten the length or change SQL type of a database column the SQL management studio must be used.

 

<type name="_file" and <refinery name="file>" elements

The _file type controls how files are handled. The element is inherited by other types like doc.

Besides defining columns and code required for handling files it also specifies refine behavior, the <refinery name="file"> element does that. Currently, both new Aspose based refinery and old MS-Office based refinery is supported, in the future when MS-Office refinery is depreciated the XML will be more simple. This documentation, however, will only describe the XML required for Aspose based refinery:

 

 

Sample snippet that changes refine of the primary file to all files in folder matching item meaning starting with item id:

 

<feature name="config-manager"> element

The feature element with the name config-manager supports various attributes that define how items should be named and how revision management should work. The feature element is related to the type in which it is declared. The following is the default declaration, in this case defining doc type behaviors:

 

NameValuesDescription
alphaid0 (default) / 1Configure the serial ID of the item to be consisting of numbers (alphaid="0") or letters (alphaid="1").
bizunitprefixinid0/1Use the ID of the business unit that created the document. May be used in multi-business unit organizations to clarify origin. Besides setting this value to 1, the parameter BizUnitPrefix must be set to a proper string value, the string value should be kept short, for example, max 3 chars.
delimiter1charDelimiter between bizunit and subtype.
subtypeinid0/1Use subtype id in document id. This would normally be the case. However, in some rare cases, there could be a need for the ability to change action subtype without changing the action id.
delimiter2charDelimiter between subtype and serial number id.
delimiter20/1Use alphanumeric instead of numeric serial number id.
delimiter3charDelimiter between serial number id and version.
alphaversion0/1Use alphanumeric instead of numeric version.
alpharevision0/1Use alphanumeric instead of numeric revision.
delimiter4charDelimiter between version and revision.
preliminary1charPlaced before version until item has been approved.
preliminary2charPlaced after revision until item has been approved.
mail-oncreate0/1 (default)Enable to allow for mails to be sent to appropriate users' when new items of the associated type is created (requires active email notification triggers to be configured).
majorRevisions0/1Enable major revisions.
minorRevisions0/1Enable minor revisions (minor change).

When making a minor change to an Approved document (if enabled), the document's status changes to Working, allowing authors to update its data, references, and files. After the changes are made, the document follows the standard review and approval process to complete the initiated Minor change.

The main version of the document does not change, but a minor version history is recorded in separate fields: Minor Version and Minor Revision. Existing references to- and from the Document remains unchanged as the primary Version is retained.

Important: A minor change must be fully Approved before starting any major change to the document.
ClearChangeNoteOnChange0/1Clear change note when item is changed.
RefHardLock0/1When you make a change to a non-approved item (i.e. where the item is in Freeze/Review/Approval ), locked references will continue referencing the existing version of an item.
Updating references must be manually maintained by users.
RefHardLockStatusEnforcement2/3/4Requires enabling of RefHardLock (RefHardLock="1") to be enforced.
Specify which specific document statuses (Freeze, Review, Approval) from which references may not be automatically updated when making a change to an unapproved document.

If a specific status is omitted, the locked reference to a non-approved item with that specific status will be automatically updated as if RefHardLock was disabled.
review-templatesubtype nameSpecifies which subtype to be used as review template. The following would set review template to the type MÓM (Minutes Of Meeting):

<type name="doc" <feature name="config-manager" review-template="MOM" /> </type>
softtemplates0/1If you change an approved item, the folder will be updated with the contents of the item specified in the 'SoftTemplate' data column.

If no version is specified, the latest approved version's contents will be used.
change-undo0/1Enables the the option for users to undo an immediate Change on an item to revert back to the previous version prior to the change.

The UNDO-CHANGE will delete the current version of the item altogether and promote the previous version of the item to the latest.


The UNDO-CHANGE button, when enabled, is available within the Advanced section (requires a set user level of AdvancedUser) on any item.

Disabled (default): change-undo="0".
Enabled: change-undo="1".
change-writeList of vector-roleschange-write determines which vector roles that is allowed to perform a change on item.
Default is: resource1,manager,teammember,superuser

Complete list of vector roles can be found in SYSTEM > DIAGNOSTICS -> VECTOR ROLES
cloak-uncloak0/1Inventor MCAD specific feature. Enable button author that makes it possible to hide folder from author.
min-status-child-enforcement1-5 (default: 2)Parameter controlling the enforcement of all references to Documents/Parts/Devices to be updated (having the same or later status compared to the parent) before the parent item can be stepped to the same status.

This parameter allows for you to specify a select status (of the parent item) from where the children are required to have the same (or later) status as the parent.

For references to be considered for this enforcement, their associated basetype must be assigned to the min-status-children-scope.

Default: min-status-child-enforcement="2" (parent item can be stepped to Freeze without enforcing all child references to be in Freeze beforehand. For Review/Approval/Approved - child references are required to have, at least, the same status before the parent item be stepped.
min-status-children-scopeList of basetypesParameter controlling which basetypes (default or custom) of child references to be considered for min-status-child-enforcement.

Default: min-status-children-scope="doc;part"
version-numeric-start-valueNumber.
Default value: 1
Parameter controlling the revision starting value. Must be a numeric value.
To change to 0, add following to custom.schema:

<type name="doc"> <feature name="config-manager" version-numeric-start-value="0" /> </type>

 

Many of the attributes control the naming of items. By default, a document may be named GD12345-1A, where various parts of the ID are:

naming-contention

ID elementDescription
GDtype (subtype)
12345Serial number ID
-Delimiter3
1Version
ARevision

 

Complete list of terms that may be used to build item ID is:

<bizunit>,<delimiter1>,<subtype>,<delimiter2>,<number>,<delimiter3>,<version>,<delimiter4>,<revision>

The various terms may be controlled by feature attributes.

 

Samples

The following sample enables the Change-undo button:

The UNDO-CHANGE can now be accessed and initiated from any item page within the Advanced options section (requires a minimum set userlevel of AdvancedUser):

1-access

Note: Progressing the item after a Change (e.g. sending the Document to Freeze, Review, approval etc.) will make UNDO-CHANGE unavailable, as it can only be used immediately after a CHANGE on the item.

 

The following sample sets MM subtype as a review template:

 

The following sample enables minor revisions

The following sample illustrates using alpha version, numeric revision, preceding with “P” for preliminary and no delimiter:

The following sample enables parent items to be in review ahead of the children:

The following sample sets a requirement for child items to be frozen before parents can be frozen:

 

 

<feature name="reference-manager"> element

The feature element with the name reference-manager allows for complete control over which types of references can be added to items of specific types under certain conditions (as managed by associated vector roles). The Reference-manager feature element can be configured on all available basetype and/or subtypes in Highstage.

The feature element is related to the type in which it is declared and specifies:

 

Available elements and attributes

Attributes

NameDescriptionValuesMandatory
nameMandatory name of elementreference-manager✔️

Elements:

NameAvailable attributesDescription
<profile>name, roles, typesEach unique profile specifics which types of items can be managed as references by associated vector roles (users under specific conditions).

 

<profile> element

Each unique <profile> element are used to define which types of references can be managed (added/updated/removed) by specific roles (select users under certain conditions as defined by listed vector roles).

Any number of unique <profile> elements can be added.

Attributes

NameDescriptionMandatory
nameUnique name of the <profile> element.✔️
rolesList of vector roles allowed to manage references.✔️
typesList of permitted item types to be managed as references (Note that listed types are case sensitive).✔️
Note: Please notice that the listed types are case sensitive. For this reason you must ensure that the list of permitted item types are identical (with regards to upper and lowercase characters) to what is defined as the name in the type definition.

 

Default configurations

Documents

Parts

Devices

Actions

Entities (Projects, Customers, Departments, Manufacturers, Products etc.)

Note: declaring * within the types attribute means that you consider all available base- and subtypes (default and custom types).

Please note that using * in the types attribute prevents you from creating any additional profiles with potential exceptions to the existing profile as it will be overruled. If you want to create additional profiles, then you may not use * in the types attribute - but instead type in the explicit types to be considered.

 

Samples

Allowing all users to add references of any type

The following sample permits all types of references to be added to Documents by all users at all times (regardless of document status):

 

Allowing references of basetypes but excluding specific subtypes

The following sample illustrates how profiles can be configured to allow for various basetypes to be added as references, but exclude specific subtypes:

In the above sample we allow all users to add/remove/modify references of type Documents, Parts, Devices and Actions. We then create a new profile (excluded) as an exception where the disallow anyone to add/remove/modify references of type GD, SOP and GDO.

Note: If you make multiple profiles, remember that profiles that deal with subtypes will overrule what is specified on profiles that deal with base types. This allows you to make additions and exceptions to the basic settings.

 

Run script on Item change

Not currently supported

 

Reset column values on item change (change to Working state)

In some cases, certain field values should be reset to database default when an item is changed, i.e. set to Working state. For example, the change note should be cleared. It may, however, be discussed if the value should be cleared at any change or just when changed from the Approved state.

The column attribute change-reset-step can be used for this purpose.

The value of the attribute is set to the minimum step from which change must reset field value, so if the field must be reset when changing an approved document then the change-reset-step value must be set to 5.

The following sample clears the change note when an item is changed i.e. changes state from Approved to Working:

The First Article Inspection (FAI) sample resets FAI_note at any change change-reset-step="1".

 

First Article Inspection (FAI)

The following sample implements a solution for First Article Inspection (FAI):

 

Attribute descriptions:

AttributeDescription
FAI_checkFAI_check is a checkbox always set to 1, but the author may set it to 0, thereby signaling that FAI_check is not required.
FAI_resultFAI_result is a multivalued field that can be set to the result of the inspection.
FAI_noteFAI_note is a note. Data cannot be deleted, only added to the field, date and users ID is also added at each note addition.
FAI_note_dataFAI_note_data is the physical column. This column may be written by AdminWrite to correct errors.

 

Note field for adding user comments

In some situations, it is desirable to have the possibility for users to add notes related to an item. The notes could be added any time, by any user, even if the item has been approved.

Using database column

Columns of SQL type text and ntext supports the text-add attribute with the following values:

 

When the text field with the text-add attribute is edited, the field text in edit dialog is initially empty. When the user enters text and clicks ok the text is either appended or prepended to the existing field text in the database, the text is also prepended with DateTime and user id. Previously entered text cannot be modified.

For everyone to be able to write at any time, the write attribute has to be set to everyone.

By setting cssclass to ts-notesizelimit the field is limited in size on the web page. If field content is very large, then the field is still fairly small and has a vertical scrollbar.

Sample defining new column named NotePad, with text-add attribute set to prepend:

Remember to apply changes by navigating to SYSTEM > SCHEMA > APPLY

 

Using Eventlog

The following implementation defines a virtual column (comments_) and adds the column to a subform in doc type. Since part and device types inherit from doc type, the field will also be available in these types. New comments are added to the event log, and a section shows all columns related to the item.

 

  1. Copy the following text to the file comments.schema.xml in tweak folder:

 

  1. Copy the following text to the file comments.exe.aspx in tweak folder:

 

  1. Include comments.schema.xml in custom.schema.xml by including the following snippet in the custom.schema.xml file:

Note that the line should be placed after the line which includes the highstage.schema.xml

 

Virtual columns

Columns do not need to be physical database columns. Columns may be virtual. By setting the virtual attribute Highstage does not create a physical column in the database, and depending on other column attributes Highstage may not fetch data from the database either.

 

Virtual column as alias to physical column

The following is a sample of creating a virtual column that is “identical” to another physical column. However, it has another name.

The new virtual column name is Author, and it reuses the physical column EditBy:

 

Author will inherit all attributes of EditBy. Author may overrule inherited attributes without affecting EditBy column. Observe that code behind hooked up on Author column will not be inherited by EditBy column.

 

Virtual column with SQL select

A column may use SQL select to get data to be displayed in Highstage.

 

Display parent description

The following sample displays first parent action description:

 

Dispaly age using sql datediff

This sample displays age of Item as the diff between CreateDate and actual date:

 

Mails

Send mail from custom code

The following snippet is an example for sending a mail. The parameters are strings:

 

Eventlog

Insert event into Eventlog by custom code

Sample code for logging an event related to an object. Remember to replace type-name with <object-id> valid values:

 

If the event is not related to a specific type, then the type and object can be set to String. Empty or null. This is an example of logging mail send event to Eventlog:

 

References

Using (ref-type) element to specify grid-columns for specific child type

In some situations, it may be desirable for parent type to specify grid and/or columns for child references of a given type.

By placing this in parent type schema, child parts' will be displayed using the BOM grid (if the BOM grid has been defined in part type):

By placing this in parent type schema, the child doc’s grid will only display item and description columns:

The grid and columns attributes may be combined.

The ref-type element can be specified at basetype or subtype level.

 

Ability to expand references (+/-) in search grid for special types

By default only types based on ts_item has the ability to expand references directly in search grid.

To allow this ability for types based on ts_entity add the following snippet to custom.schema.xml:

The types attribute specifies all referenced types to be listed in search grid, however ts_ref is the placed leftmost in grid with +/- button. Other types would be placed rightmost in grid.

 

Reference filter and refilter

The use of refilter should be avoided on basetypes.

 

Highstage is supplied out-of-the-box with no use of refilter. Raw filter is used for all references. The reason is that no references should be hidden. Even if references are obsolete, not latest, closed or any other reason they should always be visible in reference section. Raw filter shows the truth which may be visible any other place. References may be exported to suppliers or customers, and if they are visible there then they should be visible here as well.

The reason to use refilter may be to only show open actions. This may be achieved by using the object element search-parameters attribute.

 

Roles

Trustees on roles

By default only DefaultTrustees defined by parameter are able to see all users. This may be important in cases when customers and/or suppliers have access to the system and these users may not be able to see each other’s existence.

In some situations, when customers or suppliers have no access to the system it may however be desirable to have all users have the ability to see each other, in this case the following xml snippet may be added to custom.schema.xml:

 

Set Trustees on existing roles to Everyone, either by multi-edit or by executing the following SQL update:

 

Place specific subtype in specific workspace

By placing the following schema snippet in subtype schema the user will be guided to place item in workspace 000:

 

The following snippet will enforce subtype to be placed in workspace 000, only SuperUsers will be able to change workspace after item is created:

 

Form title customization

The form title may be changed by code behind. The following sample shows how to include workspace and in case of action items also the subtype on first title line, and in second line the subtype title and item title.

 

Custom.schema.xml

Include this xml snippet in custom.schema.xml:

 

Code behind

Include the following code in file item.exe.aspx located in TSWebApp/tweak folder:

 

 

Advanced detailed menu and main page permissions

To restrict access to certain elements like section and links on menu and main page the trustees attribute may refer to a specific field in database containing list of trustees.

One build-in sample using this approach is the Create type (subtype) link for items like actions, documents, parts and devices. The trustees attribute refers to TrustCreate on the ts_subtype basetype.

 

Similar if we imagine Highstage used as a contract archive where all contracts are stored on a confidential LEGAL workspace, then the menu could contain a menu that is only visible to LEGAL workspace trustees:

 

The main page could contain a section with contracts to process:

 

The create form for contracts would ensure that all new contracts are forced to LEGAL workspace by setting LEGAL as workspace value, and hiding the field from user or disabling changing field value by setting write attribute to 0:

 

Create automation

Specify suppliers in create form and add references on create

Define virtual column suppliers in custom.schema.xml, and add it to create form. Also add an execute to the file doc.exe.aspx which is defined below:

 

Create the file doc.exe.aspx with the method OnAfterCreate:

 

Refinery

Disable pdf file creation in Excel refine

Pdf rendition may be disabled by adding the following snippet to custom schema:

 

Disable refine on Excel files

To disable Excel file refine, so that excel files are not touched by Highstage refinery, add the following code snippet to custom schema:

 

Add properties directly in schema without code

New properties may be added like in the following snippet to custom.schema.xml:

 

Folder refine

Folder refine is executed after all file refines has been executed.

The following are two folder refine samples FolderRefine1 and FolderRefine2. FolderRefine2 has the ability to be executed by user as well.

 

FolderRefine1.exe.aspx:

 

FolderRefine2.exe.aspx:

 

Item change permissions

By default the following vector roles has permissions to change an item:

 

This may be modified to include for example DefaultTrustee:

 

Moving subforms using x-index and y-index

Subforms may be moved relatively to each other by changing x-index and/or y-index attributes. Since it is relatively to other subforms, it is good to know the x-index and y-index values of the other subforms. This can be investigated in two ways:

 

  1. In the merged schema in menu System/Types SchemaXml column rightmost:

Types

schema-order

 

  1. By System/Trace/Execution:

System>Execution

index-location

x-index and y-index values can be positive and negative, and they can be floating points.

Even though x-index and y-index values can be set to very large values the forms won’t be as large. The x-index and y-index are just used to position subforms relative to each other, so subforms with very big values will just be positioned far right or at the bottom.

Default x-index and y-index values are 0, and the default subform position behavior is to place the subforms in the order they appear in schema.

 

Sample

Move Document options subform down below the document properties:

 

Make a grid column narrow

The column attribute header-cssclass together with a css snippet can do it.

Sample making EventTime grid column narrow:

 

xml snippet in custom.schema.xml:

 

css snippet in custom.css:

 

Show image/picture from item folder on web page

If image is only required on item form, then this schema snippet added to form element is a very simple solution showing a well-defined image file name on web page:

 

Alternatively, the functionality could be added as a column with a cform so that image can appear in searches:

 

If the following schema is added to schema, then the image will be zoomed when cursor hoovers image:

 


highstage_footer