Proc: object type

Properties

Name Type Description
name string The procedure’s unique uppercase ‘Priority’ name.
title string The procedure’s descriptive title.

Introduction

Priority’s procedures are usually a sequence of individual steps, with some of them requiring user input. Only after the input for a step is complete does the procedure move on to the next step. Running procedures via the Web SDK follows the same structure. When a procedure is called, the response includes (in the data object) the current input step, which can be one of several types. These step types are outlined in the table below.

Step Type Description Corresponding Functions
inputFields Fields that require user input. inputFields
inputOptions Present a choice to the user. inputOptions
inputHelp Displays help text regarding the procedure inputHelp
message An error/warning/informational message displayed by the procedure. message
upload Allows the user to specify a file to upload for processing by the procedure. uploadFile or uploadDataUrl
reportOptions If multiple formats are defined for a report, allows the user to choose the desired format. reportOptions
documentOptions If multiple formats are defined for a document, allows the user to choose the desired format. documentOptions
displayUrl Contains the display url of a produced report/document. continueProc
‘client’ Sends data from the server to the client. clientContinue
end Indicates the procedure has ended (due to error/completion). None necessary.

For each step type, there is a corresponding function to be called to fill in the input. Once input is specified, ProcSuccessCallback is called again, and the next procedure step that requires input is returned from the server, with its own step type. This continues until the end of the procedure is reached (the end step type is returned).

Here’s an example of this workflow, using the Order Confirmation procedure, which creates an order confirmation document on the server.

  1. We run the WWWSHOWORDER procedure using procStart.
  2. ‘ProcSuccessCallback’ is called, and returns a data object, with a step type of documentOptions, allowing the user to choose the print format for the order confirmation.
  3. We respond to this step type by using the corresponding documentOptions function, specifying the desired print format.
  4. ‘ProcSuccessCallback’ is called again, this time returning a step type of inputFields, where the user can pick the order to print a confirmation for.
  5. We use the corresponding inputFields function to respond to this step type, specifying the order to print.
  6. The server now creates the file, so this time, the step type returned is displayUrl, informing us of where the file is saved on the server.
  7. To continue the procedure, we use the corresponding continueProc function.
  8. Finally, ‘ProcSuccessCallback’ returns a step type of ‘end’. This lets us know the procedure has been completed.



ProcSuccessCallback : function

Param Type Description
data Object The step reached by the procedure (the type of input it requires) .

The data object can be one of several types, and each type has a corresponding function to address that type. Function names are almost always identical to the type they correspond to. Once one of these functions completes, it automatically calls ProcSuccessCallback for the next step of the procedure, until the end step is reached. For example, when generating an Order Confirmation document, the first instance of ProcSuccessCallback will yield a data object containing documentOptions. After specifying the desired format with the documentOptions function, ProcSuccessCallback is called again and yields a data object of the type inputFields, where the user can specify for which order to generate the confirmation document using inputFields, and so on.



inputFields: object type

This data type describes a dialog where the user has to fill in one or more fields in order for the procedure to run. It is the most common procedure data type.

Note: Dates should be sent and received as ISO formatted dates. Time should include the timezone offset (e.g. 2018-08-14T10:00:00.000+03:00).

Structure of the data object:

Name Type Description
proc object The current procedure’s object
type string Describes the data type (“inputFields”)
input inputFieldInput Container

Example:

input:Object {EditField: Array[2], Operators: Array[9], text: "", }
proc:Object {}
type:"inputFields"
input: array
Name Type Description
EditField array Contains the input fields for the procedure.
Operators object Contains information about the possible operators.
text string Contains help text for the input dialog.
title string The title of the input dialog.

Example:

EditField:Array[2] [Object, Object]
Operators:Array[9] [Object, Object, Object, ]
text:""
title:"Parameter Input"
EditField: array
Name Type Description
code string One of “Str” / “Rstr” / “Bool” / “Real” / “Int” / “Date8” / “Date10” / “Date14” / “Time5” / “Time6”
type string Describes the type of variable in code - text, checkbox, number, date, or time.
field number Field ID.
helpstring string Contains the help text for the specific input field.
ispassword number Indicates if the field is a password.
mandatory number Indicates if the field is mandatory and must be filled.
operator n umber Default operator (saved from the previous run).
readonly boolean Indicates if the field is read-only, i.e. it must use values from a choose list.
title string The field’s title.
value string Default value (saved from the previous run).
value1 string Default second value (if operator is “between”).
maxlength number Field’s maximum length.
zoom string Various field attributes (“None” / “Attach” / “Search” / “Choose” / “Zoom” / “Date14” / “Date8” / “Date10” / “EMail” / “URL” / “HiddenZoom” / “LinkFile” / “QEdit” / “SpecialAttach”).

Note: A zoom value of “Attach” in a field indicates that the input should consist of a file. Use the fileUpload method to fill in this value - it will automatically add the file’s location on the server as the input (once upload is complete).

Example:

0:Object {field: 1, helpstring: "\nSpecify the code of the special offer in which yo…", isboolean: 0, }
columntype:"Str"
field:1
helpstring:"\nSpecify the code of the special offer in which you want to include customers."
mandatory:0
operator:0
readonly:0
title:"Offer Code"
value:"1"
value1:""
width:56
zoom:"Choose"
Operators: array
Name Type Description
name string Operator name
op number Operator ID
title string Operator title

Example:

0:Object {name: "= ", op: 0, title: "equals"}
name:"= "
op:0
title:"equals"

Possible Operators

Some operators might not be available in certain situations. For example, if the input fields include From Date and To Date, an exact date (equals) must be specified.

name op title
”= “ 0 “equals”
”< “ 1 “less than”
”<=” 2 “less than or equal to”
”> “ 3 “greater than”
”>=” 4 “greater than or equal to”
”<>” 5 “not equal to”
”- “ 6 “between”
”! “ 7 “and NOT”
”| “ 8 “or”

inputFields(ok, data, successCallback, errorCallback)

Call this function as a response to a procedure’s inputFields data type.

Param Type Description
ok number 1: OK, 0: Cancel. Move to the next step of the procedure with the input in data, or cancel the procedure entirely.
data InputFieldsReturns The desired input for this step, specified within the object.
successCallback SuccessCallback called on success.
errorCallback ErrorCallback called on error.
InputFieldsReturn: object type

Used to return the user’s input in various fields to the server.

Param Type Description
EditFields EditFieldReturn Input data for the various input fields.
EditFieldReturn: array type

Specify the values to be entered in the various input fields.

Param Type Description
field number Field ID number
op number Operator ID number
value string Input value
op2 number When specifying a range of values (between X and Y), the operator determining the relationship to the second value.
value2 string When specifying a range of values (between X and Y), the second value.


inputOptions: object type

This data type describes a dialog where the user has select an option in order for the procedure to run. In Priority’s web interface, these options would show as radio buttons (when more than 8, as a listbox). Structure of the data object:

Name Type Description
proc object The current procedure’s object
type string Describes the data type (“inputOptions”)
input object Container

Example:

input:Object {Options: Array[3], text: "", title: "Prep. Type"}
proc:Object {}
type:"inputOptions"
input: object type

This data type indicates a step where the user should choose a single option out of two or more possible options (radio buttons).

Structure: |Name | Type | Description | | — | — | — | |Options|array| Contains the choice fields for the procedure. | |helpstring|string| Contains help text for the dialog.| |title|string| The title of the dialog.|

Example:

Options:Array[3] [Object, Object, Object]
text:""
title:"Prep. Type"
Options: array
Name Type Description
field number Option ID
help string Contains the help text for this field.
name string Option name
selected boolean Indicates whether the option has been selected. Only one option can be selected.
title string Option title

Example:

0:Object {field: 1, help: "There is no help.", name: "CH1", }
field:1
help:"There is no help."
name:"CH1"
selected:0
title:"Unprepared Forms"

inputOptions(ok, selection, successCallback, errorCallback)

Call this function as a response to a procedure’s inputOptions data type.

Param Type Description
ok number 1: OK, 0: Cancel.
selection number selected option ID.
successCallback SuccessCallback called on success.
errorCallback ErrorCallback called on error.



inputHelp: object type

Some procedures include an introductory or intermediate dialog that displays help text. Structure of the data object:

Name Type Description
proc object The current procedure’s object
type string Describes the data type (“inputHelp”)
input object Container

Example:

input:Object {text: "", title: "MRP Planning"}
proc:Object {}
type:"inputHelp"
input: object
Name Type Description
text string Help text for the dialog.
title string Dialog title.

Example:

text:"The MRP planning program..."
title:"MRP Planning"

inputHelp(ok, successCallback, errorCallback)

Call this function as a response to a procedure’s inputHelp data type.

Param Type Description
ok number 1: OK, 0: Cancel.
successCallback SuccessCallback called on success.
errorCallback ErrorCallback called on error.



message: object type

An error/warning/informational message provided by the procedure. Data structure:

Name Type Description
proc object The current procedure’s object
type string Describes the data type (“message”)
message string Message text.
messagetype string The message type: “information” / “warning” / “error”.

Example:

message:"The "Material Requirements Planning" program was last run on 12/04/18."
messagetype:"information"
proc:Object {}
type:"message"

message(ok, successCallback, errorCallback)

Call this function as a response to a procedure’s message data type.

Param Type Description
ok number 1: OK, 0: Cancel (If the message only contains one button, either number is acceptable).
successCallback SuccessCallback Called on success.
errorCallback ErrorCallback Called on error.



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

Uploads a file to the server from a Blob or File object. On successful upload, the procedure continues.

Note: This function may also be called for uploading files as part of

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.
successCallback SuccessCallback Called on success.
errorCallback ErrorCallback Called on error.



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

Uploads a file to the server in dataURI format. On successful upload, the procedure continues.

Note: This function may also be called for uploading files as part of

Param Type Description
dataURI 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.
successCallback SuccessCallback Called on success.
errorCallback ErrorCallback Called on error.



reportOptions: object type

When launching a report that has multiple formats defined, allows you to choose the desired format. Structure of the data object:

Name Type Description
proc object The current procedure’s object
type string Describes the data type (“reportOptions”)
formats object Container

formats

Param Type Description
format number Format ID.
selected boolean Indicates whether the format is selected.
title string The format title.

reportOptions(ok, selectedFormat, successCallback, errorCallback)

Call this function as a response to a report generating procedure’s reportOptions data type.

Param Type Description
ok number 1: OK, 0: Cancel.
selectedFormat number Selected format.
successCallback SuccessCallback Called on success.
errorCallback ErrorCallback Called on error.



documentOptions: object type

When launching a document that has multiple display/print formats defined, allows you to choose the desired format. Structure of the data object:

Name Type Description
formats array Array of available display/print formats.
pdf boolean If true, the procedure will produce a PDF file of the document. If false, it produces a HTML document.
proc object The current procedure’s object
type string Describes the data type (“documentOptions”)
wordTemplates array Array of available Word template designs to display/print the document.

Example:

formats:Array[15] [Object, Object, Object, ]
pdf:0
proc:Object {}
type:"documentOptions"
wordTemplates: Array[10] [Object, Object, Object, ]
formats: array

Array of objects listing the available print/display formats.

Param Type Description
format number Format ID.
selected boolean Indicates whether the format is selected.
title string The format title.

Example:

0:Object {title: "By Base Product", format: -7, selected: 0}
format:-7
selected:0
title:"By Base Product"
wordTemplates: array

Array of objects listing the available word templates to print/display the document by.

Param Type Description
selected boolean Indicates whether the template is selected.
template number The template ID.
title string The template title.

Example:

selected: 1
template: -3
title: "Predefined Template"

documentOptions(ok, selectedFormat, options, successCallback, errorCallback)

Call this function as a response to a report generating procedure’s documentOptions data type.

Param Type Description
ok number 1: OK, 0: Cancel.
selectedFormat number The selected format.
options object Indicate whether to produce a PDF or HTML document - 1: PDF, 2: HTML.
successCallback SuccessCallback Called on success.
errorCallback ErrorCallback Called on error.



displayURL: object type

After generating a report, this data type displays the url on the server of the report. Structure of the data object:

Name Type Description
proc object The current procedure’s object
type string Describes the data type (“displayURL”)
Urls array The display url of the report.

Example:

proc:Object {}
type:"displayUrl"
Urls:Array[1] [Object]
Urls: array
Name Type Description
url string The URL to display.

Example:

0:Object {url: "https://example.com/dev/netfiles/ec00dep0138400…", action: "display"}
action:"display"
url:"https://example.com/dev/netfile"

continueProc(successCallback, errorCallback)

Call this method as a response to a report generating procedure’s displayURL data type.

Name Type Description
successCallback SuccessCallback Called on success.
errorCallback ErrorCallback Called on error.



client: object type

Certain standard Priority procedures use the client step to request special data from the client. This is mostly used to identify whether the current client is on a machine where the Priority App Plugin is installed and to obtain data from it.

If you encounter a procedure that includes the client step, you should respond with an empty clientContinue method (with no data specified) to continue the procedure.

You can find a full list of procedures that include this step in this list.

Name Type Description
proc object The current procedure’s object
type string Describes the data type (“client”)
data object data object sent from server to client

Example:

proc:Object {}
type:"client"
data: [data object sent from server to client]
clientContinue(data, successCallback, errorCallback)

Call this method as a response to a step of type client.

Name Type Description
data string String response to the server. Can be empty.
successCallback SuccessCallback Called on success.
errorCallback ErrorCallback Called on error.


cancel(successCallback, errorCallback)

Cancel procedure in progress.

Name Type Description
successCallback SuccessCallback called on success.
errorCallback ErrorCallback called on error.



ProcProgressCallback : function

Use this function to update a progress bar. This function is called by the SDK whenever a progress bar is called on the server by the procedure itself.

Note that as long as a progress bar was not called by the procedure on the server, this function WOULD NOT be called, even if the procedure is taking a long time (e.g., due to a long-running query).

Therefore, you should always use some sort of action indicator. Change it to a percentage indicator when this callback is called.

Param Type Description
proc Proc Procedure Object.
progress Number 0-100.


ProcErrorCallback : function

Param Type Description
proc Proc Procedure Object.
error ProcError Object.{ type: (string) - type of message: “NotSupported” / “ServerBusy” / “Error”, message: (string) - text of message }


ProcError : Object

Properties

Name Type Description
proc Proc Procedure Object.
type string The error type: “NotSupported” / “ServerBusy” / “Error”
message string Error text

For example, a ProcError might look like this:

proc:Object {}
message:"step GANTT is not supported"
type:"NotSupported"



choose(fieldId, value, data, successCallback, errorCallback)

Opens a choose/search operation for a specified field. A successful Choose function results in both a generic Proc object (describing the current procedure) and 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 - if the number is large, ‘ChooseLine’ is replaced by ‘SearchLine’. Therefore, after a successful Choose, make sure your code can address both types of results.

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

Param Type Description
fieldId number ID of field.
value string Current value in field.
data ChooseFields Data in all procedure input fields (Choose/Search results may vary depening on other fields’ values).
successCallback OpenChooseCallback Called on success.
errorCallback ErrorCallback Called on error.

ChooseFields object type

This object displays all the fields in the current procedure, of which some may affect the current choose operation. For example, if you filled in a customer, and are currently choosing a price quote, it might limit the choose operation only to price quotes opened for that customer. This object contains the ChooseField array:

ChooseField array type
Property Type Description
field number The ID value of the input field.
value string Current value in this input field.



searchAction(fieldId, value, action, data, successCallback, errorCallback)

Perform action in search dialog. Performs one of the following actions on the previously opened choose/search field:

Param Type Description
fieldId number ID of field.
value string Current value in field.
action number One of: Next(1),Prev(2),TypeChange(3),TextChange(4),StartChange(5),IgnoreCaseChanged(6)
data ChooseFields Data in all fields (Search may be dependent on other fields’ values).
successCallback SearchActionCallback called on success.
errorCallback ErrorCallback called on error.

ChooseFields object type

This object displays all the fields in the current procedure, of which some may affect the current search operation. For example, if you filled in a customer, and are currently choosing a price quote, it might limit the search operation only to price quotes opened for that customer. This object contains the ChooseFields array:

ChooseField array type
Property Type Description
field number The ID value of the input field.
value string Current value in this input field.



OpenChooseCallback : function

Param Type Description
searchObj Search A choose or search object.



SearchActionCallback : function

Param Type Description
result Search A search object.


List of Procedures with a Client Step

The following procedures contain the client step type. Note that some of these would generally only be used within the main Priority interface, but are included here for completion’s sake.

CHECKS
CLOSEPRINTAIV
CLOSEPRINTBIV
CLOSEPRINTCIV
CLOSEPRINTDIV
CLOSEPRINTEIV
CLOSEPRINTFIV
CLOSEPRINTPIV
CLOSEPRINTRIV
CLOSEPRINTSIV
CLOSEPRINTTIV
CLOSEPRINTYIV
DESIGNCHECKSTEMPLATE
DOCEXPTOMSPROJECT
DOCSENDSTARSHIP
EXPTOMSPROJECT
GMAILSYNC
HMRCVATGBR
ICSFILE
IVSENDSTARSHIP
LABELS
LABELSSET
LOADMSPROJECT
LOADRPROJWORD
OUTLOOKPORTAL
PRINTCHECK
PRINTCHECKS
PRINTEMAILDEFDOC
PRINTEMAILDEFIV
PRINTEMAILDEFORD
PRINTEMAILDEFPORD
PRINTEMAILDEFPRF
SHVA
SHVA
SHVA
SHVA
STARSHIPMAPVALUES
VEREXPTOMSPROJECT
WINOUTLHISTORY
WINOUTLOOKAUTO
WINOUTLOOKAUTOG
WINOUTLWORKAREA
WWWSHOWAIV
WWWSHOWAIVDISTR
WWWSHOWBIV
WWWSHOWCIV
WWWSHOWCIV
WWWSHOWDOC
WWWSHOWDOC
WWWSHOWDOC
WWWSHOWDOC
WWWSHOWDOC
WWWSHOWDOC
WWWSHOWDOC
WWWSHOWDOC
WWWSHOWEIV
WWWSHOWFIV
WWWSHOWRIV
WWWSHOWRIV
WWWSHOWSIV
WWWSHOWSIV
WWWSHOWTIV
WWWSHOWTIV