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, the promise is resolved, 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.
- We run the WWWSHOWORDER procedure using
procStart
. - The promise is resolved, returning a proc object with a type of
inputFields
, where the user can pick the order to print a confirmation for. - We use the corresponding inputFields function to respond to this step type, specifying the order to print.
- When the promise is resolved, the proc object is returned with a step type of
documentOptions
, allowing the user to choose the print format for the order confirmation. - We respond to this step type by using the corresponding documentOptions function, specifying the desired print format.
- 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. - To continue the procedure, we use the corresponding continueProc function.
- Finally, we get back a step type of ‘end’. This lets us know the procedure has been completed.
data : Object
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. All of these functions return promises, and when resolved return a new data object for the next step of the procedure, until the end step is reached. For example, when generating an Order Confirmation document, upon starting the procedure, the promise resolves wiht a data object of type inputFields. After specifying which order to generate the confirmation document for using the inputFields function, the server returns a new data object of type documentOptions. You can then select the desired print format with the documentOptions function, which returns a new data object with a different type, 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.
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 of objects | 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"
EditFields: 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 | number | 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)
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 | object | The desired input for this step, specified within the object. |
InputFieldsData: object
Used to return the user’s input in various fields to the server.
Param | Type | Description |
---|---|---|
EditFields | array of objects | Input data for the various input fields. |
EditFields: array of objects
Specify the values to be entered in the various input fields. Each fields is represented as an object with the following properties.
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. |
formZoom(fieldID, onShowMessgeFunc , onUpdateFieldsFunc , profile , autoRetrieveFirstRows , exParams)
Use this function to drill-down into a form that contains source data for a certain input field. This replicates the standard Priority functionality of “zooming” into a form to retrieve input. This function behaves almost identically to the formStartEx function for forms, except that rather than specifying the form, you specify the field ID of an input field.
Param | Type | Description |
---|---|---|
fieldId | int | Field ID of one of the current input fields |
onShowMessgeFunc | MessagesCallback |
Callback function for handling error and warning messages. |
onUpdateFieldsFunc | UpdateFieldsCallback | Callback function for handling form field updates. |
profile | Profile |
Object containing the company and user group in which to open the form. |
autoRetrieveFirstRows | number |
1: When opening the form, retrieve records (rows) according to the default query and store them locally. If no default query exists, retrieve top records for form. 2: Retrieve rows according to the user’s default query, if it exists. If no default query exists, open the form but do not retrieve any rows. 0: Open the form, but do not run a query. |
This function only works on input fields with a zoom value of zoom, choose, and search, although it is only available in certain choose and search fields.
After the user retrieved the desired data, use the standard endCurrentForm function to return to the procedure, while setting a value in the returnJustThisRow parameter.
This returns a proc object of type zoomvalue.
zoomvalue object type
This data type is returned after an attempt to zoom into a form from a procedure in order to retrieve data. It either describes a failure to zoom into the form, or the retrieved values.
Name | Type | Description |
---|---|---|
proc | object | The current procedure’s object |
haszoom | boolean | Describes the result of the zoom. 0 failed, 1 successful |
field | int | The field in which the zoom was performed |
value | string | If a single value is retrieved (that is, returnJustThisRow is true when using endCurrentForm), shows the value. If haszoom is 1 and this string is empty, multiple values were retrieved. |
Example:
{
"proc": {
"title": "Print Sales Invoice",
"name": "WWWSHOWAIV",
"session": "AVIAPC26360z1608046859y167"
},
"type": "zoomvalue",
"haszoom": 1,
"field": 1,
"value": ""
}
In this example, the zoom was successful and multiple records were retrieved - several Sales Invoices were selected.
After zoom is complete, you can continue the procedure as if you returned to the inputFields object type - either zooming into additional input, letting the user enter data in the input fields, or continuing the procedure with the inputFields function.
inputOptions: object type
This data type describes a dialog where the user has to select an option in order for the procedure to run. In Priority’s web interface, these options would show as radio buttons (if there are 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 |
helpstring | 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:
options: [
{
field: 2,
helpstring: '\n' +
`This report calculates a new ABC class for each material, based on actual issues over the period for which it is run, displaying that together with the standard class (designated in the "Purchase/MRP Parameters for Part" form). Select this option to leave each part's standard ABC class as is (no update).`,
name: 'CH2',
selected: 0,
title: 'No'"
},{...}]
inputOptions(ok, selection)
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. |
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)
Call this function as a response to a procedure’s inputHelp data type.
Param | Type | Description |
---|---|---|
ok | number |
1: OK, 0: Cancel. |
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)
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). |
fileUpload(file, [onProgress]) ⇒ Promise
Uploads a file to the server from a Blob or File object. On successful upload, the procedure continues.
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. |
uploadDataUri(file, [onProgress]) ⇒ Promise
Uploads a file to the server in dataURL format. On successful upload, the procedure continues.
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. |
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 array | lists available report formats. |
hasExcel | boolean | If true, current report can be sent to a spreadsheet (e.g. Microsoft Excel, Google Sheets, etc.) |
excelTemplates | object array | lists possible Microsoft Excel templates with which to output the report. |
formats
Param | Type | Description |
---|---|---|
format | number | Format ID. |
selected | boolean | Indicates whether the format is selected. |
title | string | The format title. |
excelTemplates
Param | Type | Description |
---|---|---|
selected | boolean | Indicates whether the template is selected. |
template | number | Template ID. |
title | string | The template title. |
Example
{
"proc": {
"title": "Orders for Customer",
"name": "ORDERSBYCUST"
},
"type": "reportOptions",
"formats": [
{
"title": "Basic",
"format": -101,
"selected": 1
},
{
"title": "Copy of Basic",
"format": -104,
"selected": 0
}
],
"hasExcel": 1,
"excelTemplates": [
{
"selected": 0,
"template": 937,
"title": "ExampleTemplate"
},
{
"selected": 0,
"template": 1072,
"title": "Lots of Orders"
}]
}
reportOptions(ok, selectedFormat, options)
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. |
options | object |
Optional. Use when exporting to a spreadsheet. |
options: object
Property | Type | Description |
---|---|---|
excel | boolean | if true, the report will be sent to a spreadsheet |
excelTemplate | number | Optional. Use if you want to send the report to a spreadsheet using a specific Excel template. |
Example Usage
result.proc.reportOptions(1, -101, {excel: 1, excelTemplate: 1061});
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. |
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)
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 the document as a PDF, HTML, or Word document, as well as output mode. |
options: object
Name | Type | Description |
---|---|---|
boolean | Output document as PDF 1: yes, 0: no | |
word | boolean | Output document based on Word template. 1: yes, 0: no |
mode | string | One of signature/automail/display. |
More about mode:
- singature - use this mode to prepare the document in Click2Sign mode, where the customer can sign the document online.
- automail the document will automatically be sent to the recipient (e.g. customer or vendor contact person).
- display prepare the document to be viewed/downloaded from the server.
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()
Call this method as a response to a report generating procedure’s displayURL data type.
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)
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. |
cancel()
Cancel procedure in progress.
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. |
ProcError : thrown error
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)
Opens a choose/search operation for a specified field. A successful Choose function resolves in an object of ‘Choose’ type, that contains 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’ may be 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 | Object |
Data in all procedure input fields (Choose/Search results may vary depening on other fields’ values). This data is contained in the ChooseFields array |
choose data object
This object should contain an array fields in the current procedure which currently have a value, 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 array is composed of objects with the following properties:
ChooseField array of objects
Property | Type | Description |
---|---|---|
field | number |
The ID value of the input field. |
value | string |
Current value in this input field. |
Example
let procedure = await priority.procStart("WWWSHOWDOC_Q", "P", null);
let ChooseProps = {};
ChooseProps.ChooseFields = [];
ChooseProps.ChooseFields[0] = {
field: 1,
value: ""
};
const procChoose = await procedure.proc.choose(2, '', ChooseProps);
// The returned object can contain either search or choose results - your code should support both
if(procChoose.Search.SearchLine === undefined){
console.log(procChoose.Search.ChooseLine)
} else {
console.log(procChoose.Search.SearchLine)
}
Returned object Example
{
proc: {
title: 'Print Service Call Form',
name: 'WWWSHOWDOC_Q',
session: 'PRIDEV23e8z1654668601y378',
message: [Function (anonymous)],
reportOptions: [Function (anonymous)],
documentOptions: [Function (anonymous)],
inputFields: [Function (anonymous)],
inputOptions: [Function (anonymous)],
inputHelp: [Function (anonymous)],
continueProc: [Function (anonymous)],
cancel: [Function (anonymous)],
choose: [Function (anonymous)],
searchAction: [Function (anonymous)],
uploadFile: [Function (anonymous)],
uploadDataUrl: [Function (anonymous)],
clientContinue: [Function (anonymous)],
formZoom: [Function (anonymous)],
cancelFileUpload: [Function (anonymous)],
isSupported: [Function (anonymous)]
},
type: 'Choose',
Search: {
title1: 'Sort',
title2: 'Description',
alignright1: 0,
alignright2: 0,
ChooseLine: [ [Object], [Object], [Object] ]
}
}
searchAction(fieldId, value, action, data)
Perform action in search dialog. Performs one of the following actions on the previously opened choose/search field:
- Next(1) - Retrieve more search results.
- Prev(2) - Retrieves the previous search results. Usually, this action is unnecessary, as previously retrieved results are cached locally.
- TypeChange(3) - Change the ‘search-by’ method. Available methods are: By Name, By Number, By Foreign Name.
- TextChange(4) - Changes the search query text.
- StartChange(5) - Specifies that the search should look for results that start with the query text.
- IgnoreCaseChanged(6) - When running a search in English (or other languages with uppercase and lowercase), toggles the ‘ignoreCase’ flag on or off.
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). |
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