Field Api

Includes methods for quickly accessing and modifying fields. This API will not work properly until the hydrateLayoutComplete stage or later. These functions are available under the convenienceApi.fieldHelper namespace.

Methods

getValue(identifier)Promise.<(Object|null)>
Gets the field value of a given field from the view model.
getHtmlElement(identifier)Promise.<(HTMLelement|null)>
Gets the html element associated with a field.
setIsEditMode(identifier, isEditMode)Promise.<(Boolean|null)>
Sets the edit mode property on the given field to the given value. Will also automatically load additional data for the field if the field requires additional data and none has been loaded for it yet.
setIsDisabled(identifier, isDisabled)Promise.<(Boolean|null)>
Sets the disable property on the given field to the given value.
setIsLoading(identifier, isLoading)Promise.<(undefined|null)>
Sets the isLoading property on the given field to the given value.
setContextualHelpText(identifier, [contextualHelpText])Promise.<(undefined|null)>
Set the contextual help text for the given field to the given value
addAdditionalData(identifier, additionalData)Promise.<(undefined|null)>
Sets the additional data property on the given field to the given value. It will also set the loading state of the field to false after applying the additional data.
setIsHidden(identifier, isHidden)Promise.<(Boolean|null)>
Sets the display attribute property on the given field to the given value. If the field is hidden it will also be flagged to not be used for in object updates.
setIsRequired(identifier, isRequired)Promise.<(Boolean|null)>
Sets the required property on the given field to the given value. It will also set the loading state of the field to false after applying the additional data.
setValue(identifier, valueToSet)Promise.<(Object|null)>
Sets the field value of a given field in the view model.
setAriaDescribedby(identifier, ariaDescribedby)Promise.<(String|null)>
Sets the aria describedby of a given field in the view model.

Properties Details

getValue(identifier) ⇒ Promise.<(Object|null)>

Gets the field value of a given field from the view model.

Returns: Promise.<(Object|null)> - a promise that resolves to the value. Resolves to null if get did not succeed.

Param Type Description
identifier Number | String | Object The identifier to use to look up the field

getHtmlElement(identifier) ⇒ Promise.<(HTMLelement|null)>

Gets the html element associated with a field.

Returns: Promise.<(HTMLelement|null)> - a promise that resolves to the html element of the field. Resolves to null if get did not succeed.

Param Type Description
identifier Number | String | Object The identifier to use to look up the field

setIsEditMode(identifier, isEditMode) ⇒ Promise.<(Boolean|null)>

Sets the edit mode property on the given field to the given value. Will also automatically load additional data for the field if the field requires additional data and none has been loaded for it yet.

Returns: Promise.<(Boolean|null)> - a promise that resolves to the new value of IsEditMode for the given field once the operation completes, or null if the operation did not succeed.

Param Type Description
identifier Number | String | Object The identifier to use to look up the field
isEditMode Boolean the flag if the field should be in edit mode.

setIsDisabled(identifier, isDisabled) ⇒ Promise.<(Boolean|null)>

Sets the disable property on the given field to the given value.

Returns: Promise.<(Boolean|null)> - a promise that resolves to the disabled property of the given field. Resolves to null if set not succeed.

Param Type Description
identifier Number | String | Object The identifier to use to look up the field
isDisabled Boolean the flag if the field should be disabled.

setIsLoading(identifier, isLoading) ⇒ Promise.<(undefined|null)>

Sets the isLoading property on the given field to the given value.

Returns: Promise.<(undefined|null)> - promise that resolves on completion of setting the loading state. Resolves to null if set did not succeed.

Param Type Description
identifier Number | String | Object The identifier to use to look up the field
isLoading Boolean the flag if the field should be in the loading state.

setContextualHelpText(identifier, [contextualHelpText]) ⇒ Promise.<(undefined|null)>

Set the contextual help text for the given field to the given value

Returns: Promise.<(undefined|null)> - promise that resolves once the contextual help text has been set. Resolves to null if set did not succeed.

Param Type Default Description
identifier Number | String | Object The identifier to use to look up the field
[contextualHelpText] String "" The contextual help text to set. Defaults to empty string "". If set to empty string: "", no contextual help will be shown and the contextual help icon will be hidden

addAdditionalData(identifier, additionalData) ⇒ Promise.<(undefined|null)>

Sets the additional data property on the given field to the given value. It will also set the loading state of the field to false after applying the additional data.

Returns: Promise.<(undefined|null)> - promise that resolves on completion of the addition of data. Resolves to null if set did not succeed.

Param Type Description
identifier Number | String | Object The identifier to use to look up the field
additionalData Array.<Object> data array of additional data to supply to the field.

setIsHidden(identifier, isHidden) ⇒ Promise.<(Boolean|null)>

Sets the display attribute property on the given field to the given value. If the field is hidden it will also be flagged to not be used for in object updates.

Returns: Promise.<(Boolean|null)> - promise that resolves to the value of the hidden property of the field. Resolves to null if set did not succeed.

Param Type Description
identifier Number | String | Object The identifier to use to look up the field
isHidden Boolean data array of additional data to supply to the field.

setIsRequired(identifier, isRequired) ⇒ Promise.<(Boolean|null)>

Sets the required property on the given field to the given value. It will also set the loading state of the field to false after applying the additional data.

Returns: Promise.<(Boolean|null)> - promise that resolves to the value of the required property of the field. Resolves to null if set did not succeed.

Param Type Description
identifier Number | String | Object The identifier to use to look up the field
isRequired Boolean true if the field should be set as a required field.

setValue(identifier, valueToSet) ⇒ Promise.<(Object|null)>

Sets the field value of a given field in the view model.

Returns: Promise.<(Object|null)> - A promise that resolves to the value set, otherwise resolves to null if it does not succeed.

Param Type Description
identifier Number | String | Object The identifier to use to look up the field
valueToSet Number | String | Object | null the value to be set.

Fixed-Length Text: <String>
Whole Number: <Number>
Date: <String>
Boolean (Yes/No): <Boolean> | null
Long Text: <String>
Single Choice: { ArtifactID: <Number>, ItemSecured: <Boolean>, Name: <String> }
Multiple Choice: { ItemSecured: <Boolean>, Objects: [{ ArtifactID: <String>, Guids: [], Name: <String> }
File: { FileID: <Number>, FileName: <String> }
User: { ArtifactID: <Number>, Name: <String> }
Custom Text: <String> | <Object>
Single Object: { ArtifactID: <Number>, ItemSecured: <Boolean>, Name: <String> }
Multiple Object: { ItemSecured: <Boolean>, Objects: [{ ArtifactID: <String>, Guids: [], Name: <String> }

setAriaDescribedby(identifier, ariaDescribedby) ⇒ Promise.<(String|null)>

Sets the aria describedby of a given field in the view model.

Returns: Promise.<(String|null)> - A promise that resolves to the value of aria described by. Resolves to null if set did not succeed.

Param Type Description
identifier Number | String | Object The identifier to use to look up the field
ariaDescribedby String The value of aria describedby that is to be set.