JavaScript Message API - HxGN EAM - 12.1 - Feature Briefs - Hexagon

HxGN EAM Custom Framework

Language
English
Product
HxGN EAM
Search by Category
Feature Briefs
HxGN EAM Version
12.1

For HxGN EAM version 11.0 and later, the HxGN EAM Custom Framework will use window.postMessage as a method for safely enabling cross-origin and cross-frame communication.

For an in depth talk on this topic, see window.postMessage documentation from Mozilla.

For example implementations, see the ISA and ESA sample JavaScript files

The custom application can communicate with EAM in the following ways:

  • Enable/disable HxGN EAM main toolbar buttons

  • Capture HxGN EAM main toolbar button clicks

  • Show HxGN EAM Error, Warning, Confirmation, Question messages

  • Direct select another screen in HxGN EAM

  • Change tabs on a screen in HxGN EAM

  • Change header records on a screen in HxGN EAM

  • Hyperlink to another screen in HxGN EAM (open hyperlink window in EAM in Insert or Query modes)

  • Close HxGN EAM hyperlink window

  • HxGN EAM hyperlink window close event

  • Invoke HxGN EAM hot keys

  • Prompt user to save changes before tab change or screen change

Enable/disable HxGN EAM main toolbar buttons example message

{

messageName: 'toolbarButtonState',

buttons: ['saveRec', 'deleteRec'], // must be an array

state: 'enable' // valid values are 'enable' or 'disable'

}

Capture HxGN EAM main toolbar button clicks example message (to be handled by the custom application)

{

messageName: 'toolbarButtonClick',

action: 'saveRec'

}

Show HxGN EAM Error, Warning, Confirmation, Question messages example message

{

messageName: 'showMessage',

message: 'MSG_ERR_WSJOBS_DEPTSEC', // You can provide your own message string here if you want, or use HxGN EAM error messages

messageType: 'question', // valid values are 'question', 'error', 'warning', and 'confirmation'

questionMessageButtons: 'YESNO' // If you are not showing a question message this property can be excluded from the message. Valid values are 'YESNO', 'YESNOCANCEL', 'YESCANCEL'. If you are showing a question message and do not provide 'buttons' property we'll default to 'YESNO'.

}

Question Message Callback example message (to be handled by the custom application)

{

messageName: 'questionMessageCallback',

answer: 'yes' // Value will be 'yes', 'no', or 'cancel'

}

Direct select another screen in HxGN EAM example message

{

messageName: 'directSelect',

systemFunction: 'WSJOBS'

userFunction: 'JBJOBS' // Optional, if userFunction is not a clone screen then it's not necessary to provide in the messasge

drillbackParams: { // Optional, drilldown to a specific record. Record View only.

<key_field_name>: <key_field_value>,

<key_field_name>: <key_field_value>,

etc...

}

}

Change tabs on a screen in HxGN EAM example message

{

messageName: 'tabSelect',

tab: 'HDR' // Change from the external tab to the record view tab

}

Change header records on a screen in HxGN EAM example message

{

messageName: 'headerRecordChange',

recordId: '2' // The id of the header record in the store (must be passed down and back up again by the custom application)

view: 'uxgridsummaryview' // The header grid view currently visible to the user (must be passed down and back up again by the custom application)

}

Hyperlink to another screen in HxGN EAM (open hyperlink window in EAM in Insert or Query modes) example message

{

messageName: 'hyperlink',

systemFunction: 'WSJOBS'

userFunction: 'JBJOBS' // Optional, if userFunction is not a clone screen then it's not necessary to provide in the messasge

insertModeParams: { // Optional, one of insertModeParams or queryModeParams MUST be provided though, opens hyperlink in 'insert' mode, all properties within the object are required

destinationField: <desintation_field_name>, // The target field to write a value to

sourceFieldValue: <source_field_value>, // The value to write to the destination field

},

queryModeParams: { // Optional, one of insertModeParams or queryModeParams MUST be provided though, opens hyperlink in 'query' mode, all properties within the object are required

dataspyId: <dataspy_id>, // The id of the dataspy to run the query against

filterField: <filter_field_id>, // The filter field id

filterOperator: <filter_operator>, // The filter operator (IE: BEGINS, CONTAINS, etc...)

filterValue: <filter_value> // The value to filter by

}

}

Close HxGN EAM hyperlink window (useful when you want to close the hyperlink window from a popup invoked from your custom application). If multiple hyperlink windows are open they are all closed (if this message is called from a custom tab or custom screen from within EAM). If you open your custom screen in an HxGN EAM hyperlink window, which in turn opens another hyperlink window, etc... all hyperlink windows will be closed except the one containing the custom application hyperlink.

If you pass the 'data' object with name value pairs, it is exclusively up to the custom app to pass number/date values in the format that HxGN EAM expects exactly, if you do not do this, the values will not be set properly or may cause errors. There is nothing the HxGN EAM base product can do about this, we assume you know what you're doing.

{

messageName: 'closeHyperlink',

data: { // Optional - HxGN EAM form field ids and values that will be set on the calling form when 'Return Value' button is pressed in the hyperlink window, this will only work when you invoke a custom application hyperlink from an HxGN EAM UDF Button

equipmentno: "JBASSET1",

organization: "JBORG1"

},

isHyperlinkWindow: false // Optional, default is false - provide this value as true if you are closing the EAM hyperlink window from within a custom application in a hyperlink, if you do not, then your data won't get set

}

HxGN EAM hyperlink window return value handler (to be handled by the custom application). HxGN EAM will post a message to your custom application about the hyperlink 'Return Value' button being clicked. It's up to the custom application to physically close the HxGN EAM hyperlink window when the user presses the 'Return Value' button. After the custom application receives this message, it should send the 'closeHyperlink' message back to EAM with the calling form field data to be set as well as the isHyperlinkWindow flag set to true (see the 'closeHyperlink' message for more details).

{

messageName: 'hyperlinkReturnValue'

}

HxGN EAM hyperlink window close event (to be handled by the custom application). HxGN EAM will broadcast a message to your custom screen or custom tab to let you know the hyperlink window has been closed, in case you need to do some follow up processing

{

messageName: 'hyperlinkClosed'

}

Invoke HxGN EAM hot keys example message

{

messageName: 'hotKey',

keyCode: <Key Code>,

ctrlKey: true,

altKey: true,

shiftKey: false,

}

Prompt user to save changes before tab change or screen change example message.

This message needs to be passed to EAM as soon as you know a form field or some other condition has marked your screen dirty. It's also up to the custom application to reset the dirty flag when the form goes from a dirty state to a clean state.

{

messageName: 'setDirtyFlag',

value: true

}