Form: object type

Properties

Name Type Description
name string The form’s uniqe uppercase ‘Priority’ name.
columns Object An object containing all of a form’s columns. Key: the column’s name, Value: a Column.
ishtml number Indicates whether the form is a html text form. 0 or 1.
ishtmleditable number If the form is a text form, indicates if the form can be edited (based on the user’s permissions). 0 or 1.
isquery number Indicates whether the form is a query form i.e. read-only. 0 or 1.
oneline number Indicates whether the form can only contain a single row. 0 or 1.
subForms Object A list of the form’s subforms. Key: the subform’s name, Value: a Subform
windowSize number The maximum number of rows to be retrieved by the default query or when using getRows.
title string The form’s title.



warningConfirm(okCancel)

Confirms a server warning message. Every operation can trigger a warning messages on the server.

This method is used to make the server aware of the last operation’s state:

Param Type Description
okCancel boolean 1: ok, 0: cancel

Returns: Void



infoMsgConfirm()

Confirms a server information message. Every operation can trigger informational messages from the server. Call this method when the user confirms they have read the message.

Returns: Void

isAlive([onSuccess], [onError]) ⇒ Promise

Checks whether a form is alive on the server. Attempting to call methods for a dead form will cause errors.

Param Type Description
[onSuccess] isAliveSuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: number- 1: alive, 0: not alive.

Reject: ServerResponse

isAliveSuccessCallback : function

Param Type Description
result number 1: alive, 0: not alive.



startSubForm(formName, onShowMessgeFunc, onUpdateFieldsFunc, [onSuccess], [onError]) ⇒ Promise

Starts a Sub-Form and sets the active row to be the first row of the Sub-Form.

See setActiveRow.

Param Type Description
formName string for example: ORDERITEMS.
onShowMessgeFunc object Callback function for handling error and warning messages (if null, uses the parent form callback).
onUpdateFieldsFunc object Callback function for handling field updates (if null, uses the parent form callback).
[onSuccess] FormStartSuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Form

Reject: ServerResponse



endCurrentForm( [onSuccess] , [onError] ) ⇒ Promise

Exits the current form. If the form is a Subform, returns to the active row originally set in the parent form. See setActiveRow.

Param Type Description
[onSuccess] SuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Empty object

Reject: ServerResponse



setSearchFilter(filter, [onSuccess] , [onError]) ⇒ Promise

Sets a search filter in a form or sub-level form. The filter is used to retrieve rows according to a certain query. See getRows. In order to clear the filter call clearSearchFilter.

Note: As long as you do not clear or change the filter, it will remain in effect. Every call to getRows will return rows according to that filter.

Param Type Description
filter Filter A filter object.
[onSuccess] SuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Empty object

Reject: ServerResponse



clearSearchFilter([onSuccess], [onError]) ⇒ Promise

Clears the search filter. After clearing the filter, the getRows method will use the default query for the form when retrieving rows.

Param Type Description
[onSuccess] SuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Empty object

Reject: ServerResponse



getRows( fromRow, [onSuccess] , [onError] ) ⇒ Promise

Returns rows data for the current form. The number of rows retrieved is limited by the windowSize prorperty of the Form object.

Notes:

Param Type Description
fromRow number The position of the first row to be retrieved.
[onSuccess] GetRowsSuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Rows

Reject: ServerResponse


GetRowsSuccessCallback : function

Param Type Description
rows Rows Form rows retrieved according to the default query or filter.


Rows : Object

{   
  "FORM_NAME" :   
          {      
            "row_index" :       
            {          
                "FIELD_NAME" : value,          
                "ANOTHER_FIELD_NAME" : value
                ...        
            },       
            "another_row_index": 
            {
              ...
            }
          } 
} 



clearRows( [onSuccess] , [onError] ) ⇒ Promise

Clears all rows of a parent form. This does not delete rows, but rather makes them inaccessible until retrieved again.

Param Type Description
[onSuccess] SuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Empty object

Reject: ServerResponse



newRow([onSuccess], [onError]) ⇒ Promise

Creates a new row in the current form, then sets it as the active row.

Param Type Description
[onSuccess] NewRowSuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: RowIndex

Reject: ServerResponse


NewRowSuccessCallback : function

Param Type Description
rowIndexObj RowIndex The new row’s index number.



setActiveRow( row, [onSuccess] , [onError] ) ⇒ Promise

Sets the active row to the specified row. Note that the row number index starts at 1.

Note: To perform actions on a row, you must first set it as the active row.

Param Type Description
row number Row index number.
[onSuccess] SuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: RowIndex

Reject: ServerResponse



fieldUpdate( fieldName , fieldValue , [onSuccess] , [onError] ) ⇒ Promise

Changes or adds a value in a field in the currently active row. The updated information is returned through UpdateFieldsCallback. After changing the value in the field, Priority triggers may be executed, updating additional fields. These changes are also returned via UpdateFieldsCallback Calling this action does not save the new value.

Param Type Description
fieldName string Name of the field. All uppercase.
fieldValue string The new value of the field.
[onSuccess] SuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Empty object

Reject: ServerResponse



saveRow(backToParentForm, [onSuccess], [onError]) ⇒ Promise

Saves all changes made to the currently active row. Updated data is returned via UpdateFieldsCallback.

Param Type Description
backToParentForm number 0: Stay in the current row after saving 1: Applicable only when saving a row in a Sub-Form. Go back to parent form, and set the parent row as the active row.
[onSuccess] SuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Empty object

Reject: ServerResponse



saveText(text, addFlag, signatureFlag, secondaryLanguageFlag, [onSuccess], [onError]) ⇒ Promise

Adds new text to a html text form.

Param Type Description
text string The new text to add. May be formatted as plain text or html).
addFlag boolean Append new text to existing text (1). Replace existing text with new text (0).
signatureFlag boolean Add a user signature (1). Don’t add a signature (0).
secondaryLanguageFlag boolean Determines the language of the signature: using the primary system language (0), or English (1). Useful when the primary language is not English.
[onSuccess] SuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Empty object

Reject: ServerResponse



undo([onSuccess], [onError]) ⇒ Promise

Undoes any unsaved changes in the current row made by fieldUpdate. This includes changes made by Priority triggers. Updated data is returned via UpdateFieldsCallback.

Param Type Description
[onSuccess] SuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Empty object

Reject: ServerResponse



delRow([onSuccess], [onError]) ⇒ Promise

Deletes the current row. Updated data is returned via UpdateFieldsCallback.

When a row is deleted, the server returns a collection of rows with updated index numbers.

Each row that was after the deleted row gets an index number prior to what it had before the delete.

Thats way the order of the rows is kept.

In this method the server returns the index of the last row. Used to update the view with the changes.

Param Type Description
[onSuccess] DelRowSuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: RowIndex

Reject: ServerResponse


DelRowSuccessCallback : function

Param Type Description
rowIndexObj RowIndex ‘rowindex’ is always the index number of the last row. Used for updating the view. See the explanation above.



choose( fieldName , fieldValue, [onSuccess] , [onError] ) ⇒ Promise

Opens a choose/search operation for a specified field. A successful Choose function results in a Search object that can contain either ‘ChooseLine’ values or ‘SearchLine’ values. The type of values in the object is not predefined for each field, but is rather dependent on the number of results. ‘ChooseLine’ is only shown when there is a small number of results (no more than a single page of results). If there are more results than can be displayed in a single page, it is replaced by ‘SearchLine’. Therefore, after a successful Choose, make sure your code can address both types of results.

Note: If the field currently contains a value, it will automatically be filled in as fieldValue, even if a different fieldValue was specified.

Param Type Description
fieldName string The field’s name (for example CUSTNAME).
fieldValue string Current value in the field.
[onSuccess] ChooseSuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Search

Reject: ServerResponse


ChooseSuccessCallback : function

Param Type Description
searchObj Search An object with ‘Choose’ values or with ‘Search’ values or null (if there are no values to choose from).



filterChooseAction(action, searchText, [onSuccess], [onError]) ⇒ Promise

Certain forms in Priority are subject to Business Process Management (BPM) restrictions. This means that users are restricted in the values they can see when running a ‘choose’ on a Status or Assigned To column. This can be an issue when users want to search for documents according to these values. This function circumvents this limitation and displays all available values. Use it when constructing a filter through user input.

In all other respects, this function is completely identical to choose.



searchAction(action, searchText, [onSuccess], [onError]) ⇒ Promise

Performs one of the following actions on the previously opened search field:

Param Type Description
action number One of the above actions.
searchText string The text to search for.
[onSuccess] SearchActionSuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not supplied.

Fulfill: Search

Reject: ServerResponse

SearchActionSuccessCallback : function

Param Type Description
searchObj Search A ‘Search’ object.



filterSearchAction (action, searchText, [onSuccess], [onError]) ⇒ Promise

Certain forms in Priority are subject to Business Process Management (BPM) restrictions. This means that users are restricted in the values they can see when running a ‘searchAction’ on a Status or Assigned To column. This can be an issue when users want to search for documents according to these values. This function circumvents this limitation and displays all available values. Use it when constructing a filter through user input.

In all other respects, this function is completely identical to searchAction.



activateStart(ename, type, progressCallback, [onSuccess], [onError]) ⇒ Promise

Starts an Action. An Action is a Procedure;

Param Type Description
ename string Name of procedure/report.
type string Specify : “R” for reports, “P” for procedures
progressCallback ProcProgressCallback Called in case the ‘activitation’ in question takes some time to complete. Indicates a progress bar should be shown.
[onSuccess] ProcSuccessCallback Optional. Called on success.
[onError] ProcErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Object. See ProcSuccessCallback

Reject: Object. See ProcErrorCallback



activateEnd([onSuccess], [onError]) ⇒ Promise

Call this after an action has finished to refresh the current form’s data.

Param Type Description
[onSuccess] SuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: Empty object

Reject: ServerResponse



getFileUrl(filename, [onSuccess], [onError]) ⇒ Promise

Translates a relative path of a file on the server to its full path. For example: ‘../../system/mail/201611/enxjf/1.pdf’ ==> ‘https://servername/primail/201611/enxjf/1.pdf’

Param Type Description
filename string The file’s relative path.
[onSuccess] GetFileSuccessCallback Optional. Called on success.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: string - file url

Reject: ServerResponse


GetFileSuccessCallback : function

Param Type Description
result string File url.



uploadFile(file, [onProgress] [onSuccess], [onError]) ⇒ Promise

Uploads a file to the server from a Blob or File object. Can be used both in a parent form and in a sub-form in file fields.

Note: This function only uploads the file to the server. Use fieldUpdate to attach it to an attachment field in a particular row.

Param Type Description
file Object A File Object (This object can be obtained from a <input type="file"> HTML tag in the view).
onProgress UploadFileProgressCallback If a file is large and uploaded in chunks, called periodically to update progress.
[onSuccess] UploadFileSuccessCallback Called on successful completion of upload.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not provided.

Fulfill: FileUploadResult

Reject: ServerResponse



uploadDataUrl(dataURL, type, onProgress, [onSuccess], [onError]) ⇒ Promise

Uploads a file to the server in dataURI format. Can be used both in a parent form and in a sub-form in files fields. Any file type in base64 format is supported, although some file types may be blocked by Priority.

Note: This function only uploads the file to the server. Use fieldUpdate to attach it to an attachment field in a particular row.

Param Type Description
dataURL string The file data you want to upload in a dataURI format.
type string The file type (e.g., .png, .pdf).
onProgress UploadFileProgressCallback If a file is large and uploaded in chunks, called periodically to update progress.
[onSuccess] UploadFileSuccessCallback Called on success and shows upload progress.
[onError] ErrorCallback Optional. Called on error.

Returns: Promise- - When both onSuccess and onError are not supplied.

Fulfill: FileUploadResult

Reject: ServerResponse



cancelFileUpload()

Cancels the current upload action. Once cancelled, the onSuccess callback of the ‘UploadFile’ request is called.



UploadFileProgressCallback : function

Param Type Description
result FileProgress Upload progress object.

UploadFileSuccessCallback : function

Param Type Description
result FileResult Uploaded file object.



Column : Object

Properties

Name Type Description
attachment number Indicates whether files can be attached in this field. 0 or 1.
decimal number For decimal fields, the decimal precision.
format string In date fields, the field’s format, e.g. ‘DD/MM/YY’. Date and time data must match the ISO 8601 datetime format and include the timezone offset (e.g. 2018-08-14T10:00:00.000+03:00).
mandatory number Indicates whether the field is mandatory. 0 or 1.
maxLength number Maximum number of characters in the field. Used for text and number fields.
readonly number Indicates whether the field is read-only. 0 or 1.
title string Field’s title that should be displayed to the user.
type string Field’s type, one of: [text,number,date,boolean etc.]
zoom string A field’s special property. Can be Search (a searchlist can be opened), Choose (a chooselist can be opened), Attach (a file can be attached. Equivalent to ‘attachment’=1) or None.



Subform : Object

Properties

Name Type Description
title string the subform’s title.



Filter : Object

Properties

Name Type Description
or number Define the operator between ALL query values. 0: AND, 1: OR.
ignorecase number 0: case sensitive, 1: case insensitive.
QueryValues QueryValue[] Array of query values to filter. Each query value defines the field to filter, relational operator, values and sort options. When using OR operator, you should limit your query to 4 fields.

Notes

Example

{
 or: (number),
 ignorecase: (number),
 QueryValues:
 [{
   field: (string),
   fromval: (string),
   toval:  (string),
   op: (string),
   sort: (number),
   isdesc: (number),
 },
 {
   ...
 }]
}



QueryValue : Object

Properties

Name Type Description
field string The field to filter by.
fromval string Indicates the from value to filter
toval string Indicates the to/until value to filter
op string Filter operator. May be one of: =, <>, >=, <=, >, <
sort number Specifies whether the returned rows should be sorted by this field. Specify 0 or 1
isdesc number When sorting by this field, specify if the sort order is 1: descending or 0: ascending.



RowIndex : Object

Properties

Name Type Description
rowindex number The row index according to the operation.



Search : Object

Properties

Name Type Description
SearchLine Object An object containing a list of search results - key is the index number and value is a SearchResult
ChooseLine Object An object containing a list of search results - key is the index number and value is a SearchResult
cursor string The currently active ‘search-by’ method. See searchAction
ignorecase number If 1, indicates that the ignore case flag was active for this search. Else, the flag is off. See searchAction.
ismulti number If 1, indicates that the current search field allows for multiple values to be selected. If 0, only one value can be chosen.
lines number The number of search results retrieved in the current Search object.
next number Indicates whether there are more search results that can be retrieved. If 1, additional results can be retrieved with searchAction. Else, there are no more results to fetch.
start number If 1, indicates that the ‘match start’ flag was active for this search. Else, the flag is off. See searchAction.
title1 string Each search result is described by two titles - a unique identifier value and a description. This is the title of the unique identifier value, e.g. ‘Customer Number’. Only displayed in a Choose list.
title2 string Each search result is described by two titles - a unique value and a description. This is the title of the description, e.g. ‘Customer Name’. Only displayed in a Choose list.
value string The search pattern used to retrieve these results.



SearchResult : Object

Properties

Name Type Description
string1 string The result’s unique identifier value. For example, if in Search, title1 is ‘Customer Number’, this might be ‘CUST001’
string2 string The result’s description value. For example, if in Search, title2 is ‘Customer Name’, this might be ‘Blue Construction Inc.’
retval string The actual value returned to the field being updated. This is usually either ‘string1’ or ‘string2’.



FileProgress : Object

This object is obtained through UploadFileProgressCallback and shows the progress of the upload.

Properties

Name Type Description
progress number A number between 0 and 100 indicating the progress of the upload.



FileResult : Object

This object is obtained through UploadFileSuccessCallback, and provides the file’s url on the Priority server.

Name Type Description
file string The fiel’s url on the Priority server.



Try It Yourself