The this binding
Helper methods and properties used to interact with the form's viewModel within an event handler via the "this" keyword.
Properties
- artifactId ⇒
Number
|Null
- Gets artifact ID. The artifact identifier of the viewModel available for View and Edit modes only.
- artifactTypeId ⇒
Number
|Null
- Gets artifactType identifier of the viewModel.
- associatedArtifactId ⇒
Number
|Null
- Gets associatedArtifact ID. When objectB is being created, and immediately associated to objectA, (particularly when launched from a "New" button in a child or associative item list on objectA's Layout) the asociatedArtifactId is the ArtifactID of the existing objectA.
- backingModelData ⇒
Object
- A copy of the viewModel data fetched from the server. It is populated with client-validated values from the volatileModelData object before it is sent to the server during a save operation.
- connectorFieldArtifactId ⇒
Number
|Null
- When objectB is being created, and immediately associated to objectA, (particularly when launched from a "New" button in a child or associative item list on objectA's Layout) the connectorFieldArtifactId is the ArtifactID of the Field on the objectB Layout which should point to (be pre-populated with) the existing objectA.
- exitDialog ⇒
Object
- An injected instance of the ExitDialog class that appears when a user leaves a form. It is activated only in Edit and Add modes.
- fieldGuidToFieldIdMap ⇒
Object
- Contains mappings of field guids to field ids. Used by the fieldHelper API. This is not defined until the hydrateLayoutComplete stage
- fieldNameToFieldIdMap ⇒
Map
- Contains mappings of field names to field ids. Used by the LayoutApi. This is not defined until the hydrateLayoutComplete stage.
- formViewModelTypeId ⇒
Number
- An ID fetched from the routeConfig settings representing the FORM_VIEW_MODEL_TYPE of the viewModel.
- isDirty ⇒
Boolean
- A boolean that determines if the current viewModel is isDirty depending on viewModel.
- isNew ⇒
Boolean
- A boolean that determines if the current viewModel is an Add viewModel depending on viewModelName..
- lastVisitedArtifactId ⇒
Number
- A routing parameter used for redirection when Edit or Add operations are canceled or when a user clicks the Save and New button.
- layoutId ⇒
Number
- A layout identifier for the viewModel. A user manually adds this value to the URL. It is not revised through the code.
- layoutMetadataCopy ⇒
Object
- Gets a copy of the layout metadata
- parentArtifactId ⇒
Number
- The parent artifact identifier of the viewModel. Available for Add mode only.
- viewModelName ⇒
String
- A string representing the name of the viewModel populated in the activate() method. It is derived from the name property of the routeConfig for the viewModel.
- volatileModelData ⇒
Object
- A copy of the backingModelData that houses the in-process user revisions to the field components of a viewModel. It is used to repopulate the backingModelData on create and update calls for the viewModel.
- workspaceId ⇒
Number
- The workspace identifier of the viewModel. Available in all Edit, View, and Add modes.
Methods
- clearErrorSummary() ⇒
undefined
- ClearErrorSummary clears all errors from the errorContainer object.
- clearModelData() ⇒
undefined
- clearModelData Clears backingModelData and volatileModelData. This function clears any stored in-process revision that the user has made to the form. This update isn't reflected in the UI.
- getFieldIdForField() ⇒
Number
- Gets the field id for the field that matches the given identifier.
- handleApplicationError(error) ⇒
undefined
- Acts as a handler for irrecoverable errors. It deactivates any open ExitDialog instance, writes the error using the logger, and redirects to the error page for an application.
- handlePermissionDeniedError() ⇒
undefined
- Acts as a handler for permission denied errors. It deactivates any open ExitDialog instance and redirects to the permission denied error page for an application. It is useful for handling custom authorization rules in event handlers.
- refreshLayout() ⇒
undefined
- Refreshes page layout executing needed event handlers.
- setErrorSummary(messages, expand) ⇒
undefined
- Updates the errorContainer object with error metadata.
Properties Details
artifactId ⇒ Number
| Null
Gets artifact ID. The artifact identifier of the viewModel available for View and Edit modes only.
Returns: Number
| Null
- Artifact ID.
artifactTypeId ⇒ Number
| Null
Gets artifactType identifier of the viewModel.
Returns: Number
| Null
- artifactType ID.
associatedArtifactId ⇒ Number
| Null
Gets associatedArtifact ID. When objectB is being created, and immediately associated to objectA, (particularly when launched from a "New" button in a child or associative item list on objectA's Layout) the asociatedArtifactId is the ArtifactID of the existing objectA.
Returns: Number
| Null
- associatedArtifact ID.
backingModelData ⇒ Object
A copy of the viewModel data fetched from the server. It is populated with client-validated values from the volatileModelData object before it is sent to the server during a save operation.
Returns: Object
- returns backingModelData of viewModel.
connectorFieldArtifactId ⇒ Number
| Null
When objectB is being created, and immediately associated to objectA, (particularly when launched from a "New" button in a child or associative item list on objectA's Layout) the connectorFieldArtifactId is the ArtifactID of the Field on the objectB Layout which should point to (be pre-populated with) the existing objectA.
Returns: Number
| Null
- connectorFieldArtifactId.
exitDialog ⇒ Object
An injected instance of the ExitDialog class that appears when a user leaves a form. It is activated only in Edit and Add modes.
Returns: Object
- returns exitDialog of viewModel.
fieldGuidToFieldIdMap ⇒ Object
Contains mappings of field guids to field ids. Used by the fieldHelper API. This is not defined until the hydrateLayoutComplete stage
Returns: Object
- return fieldGuidToFieldIdMap of viewModel.
fieldNameToFieldIdMap ⇒ Map
Contains mappings of field names to field ids. Used by the LayoutApi. This is not defined until the hydrateLayoutComplete stage.
Returns: Map
- returns fieldNameToFieldIdMap of viewModel.
formViewModelTypeId ⇒ Number
An ID fetched from the routeConfig settings representing the FORM_VIEW_MODEL_TYPE of the viewModel.
Returns: Number
- returns formviewModelTypeId of viewModel.
isDirty ⇒ Boolean
A boolean that determines if the current viewModel is isDirty depending on viewModel.
Returns: Boolean
- return boolean value if the current viewModel is isDirty of viewModel.
isNew ⇒ Boolean
A boolean that determines if the current viewModel is an Add viewModel depending on viewModelName..
Returns: Boolean
- return boolean value if the current viewModel is an add viewModel .
lastVisitedArtifactId ⇒ Number
A routing parameter used for redirection when Edit or Add operations are canceled or when a user clicks the Save and New button.
Returns: Number
- returns the lastVisitedArtifactId of the viewModel.
layoutId ⇒ Number
A layout identifier for the viewModel. A user manually adds this value to the URL. It is not revised through the code.
Returns: Number
- returns the layoutId of the viewModel.
layoutMetadataCopy ⇒ Object
Gets a copy of the layout metadata
Returns: Object
- A copy of the layout metadata that includes transformed group
parentArtifactId ⇒ Number
The parent artifact identifier of the viewModel. Available for Add mode only.
Returns: Number
- returns the parentArtifactId of the viewModel.
viewModelName ⇒ String
A string representing the name of the viewModel populated in the activate() method. It is derived from the name property of the routeConfig for the viewModel.
Returns: String
- returns viewModelName.
volatileModelData ⇒ Object
A copy of the backingModelData that houses the in-process user revisions to the field components of a viewModel. It is used to repopulate the backingModelData on create and update calls for the viewModel.
Returns: Object
- returns volatileModelData.
workspaceId ⇒ Number
The workspace identifier of the viewModel. Available in all Edit, View, and Add modes.
Returns: Number
- returns workspaceId.
clearErrorSummary() ⇒ undefined
ClearErrorSummary clears all errors from the errorContainer object.
Returns: undefined
- clears all the errors from errorContainer
Example
viewModel.clearErrorSummary();
clearModelData() ⇒ undefined
clearModelData Clears backingModelData and volatileModelData. This function clears any stored in-process revision that the user has made to the form. This update isn't reflected in the UI.
Returns: undefined
- Clears backingModelData and volatileModelData
Example
viewModel.clearModelData();
getFieldIdForField() ⇒ Number
Gets the field id for the field that matches the given identifier.
Returns: Number
- getFieldIdForField.
Example
const fieldId = viewModel.getFieldIdForField(4544558);
handleApplicationError(error) ⇒ undefined
Acts as a handler for irrecoverable errors. It deactivates any open ExitDialog instance, writes the error using the logger, and redirects to the error page for an application.
Returns: undefined
- redirects to the error page for an application.
Param | Type | Description |
---|---|---|
error | Object
|
error object |
Example
const handleAppError = viewModel.handleApplicationError({error:"error exists in page handling" });
handlePermissionDeniedError() ⇒ undefined
Acts as a handler for permission denied errors. It deactivates any open ExitDialog instance and redirects to the permission denied error page for an application. It is useful for handling custom authorization rules in event handlers.
Returns: undefined
- handlePermissionDeniedError. redirects to permission denied page
Example
const handlePermissionDeniedError = viewModel.handlePermissionDeniedError();
refreshLayout() ⇒ undefined
Refreshes page layout executing needed event handlers.
Returns: undefined
- refreshes the contents.
Example
viewModel.refreshLayout();
setErrorSummary(messages, expand) ⇒ undefined
Updates the errorContainer object with error metadata.
Returns: undefined
- updates the errorContainer
Param | Type | Description |
---|---|---|
messages | List.<String>
|
messages to display. First is shown in the title bar. Any others are shown in the error list. |
expand | Boolean
|
expand the error container when more than one message needs to be displayed |
Example
const result = viewModel.setErrorSummary([errorMessage]);