Procedures & Reports
Procedures and reports in Priority ERP are multi-step operations that may require user input, confirmations, and produce output. The MCP server provides procedure_start and procedure_continue to drive these flows programmatically.
Overview
The procedure flow is a state machine:
- Start – Call
procedure_startto begin. Receive the first step. - Continue – Call
procedure_continuewith the appropriate action for each step type. - Repeat – Keep calling
procedure_continueuntil the procedure ends.
Each response tells you the current step_type and what data is needed to proceed.
Starting a Procedure
First, find the procedure using entity_search:
{
"company_name": "mycompany",
"name_search": "WWWSHOWORDER",
"search_category": "procedures_and_reports"
}
The response includes a procedure_type (P or R). Use both values to start:
{
"company_name": "mycompany",
"procedure_name": "WWWSHOWORDER",
"procedure_type": "P"
}
The response includes a session ID and the first step.
Step Types
| Step Type | Meaning | Action Required |
|---|---|---|
input |
Procedure requests parameter values | Provide field values |
choose |
Procedure presents options to select from | Select one option |
warning |
Procedure shows a warning message | Acknowledge |
newsaved / askprint |
Report output is ready | Choose format/mode |
waitprocess / waitexecution |
Background processing | Poll (repeat call) |
displayurl |
URL to display | Read URL from response |
download |
File available for download | Read download URL from response |
end |
Procedure complete | No further action |
Input Steps
Input steps present fields that need values. Each field has an id, a type, and may have a “Current Value” (the last value used when this procedure was previously run).
Critical rules:
- You must send back ALL fields, even ones you are not changing
- Use the Current Value as the starting point for each field
- Do not submit all fields as empty unless explicitly intended – this may cause the procedure to process all available data
{
"session": "session-id-here",
"company_name": "mycompany",
"procedure_name": "WWWSHOWORDER",
"procedure_type": "P",
"step_type": "input",
"action": {
"fields": [
{ "id": 1, "operator": "=", "value": "SO24001234", "type": "char" },
{ "id": 2, "operator": "=", "value": "01/01/26", "type": "date8" },
{ "id": 3, "operator": "=", "value": "", "type": "char" }
]
}
}
Some input steps present choose options instead of fields. In that case, provide selected_option with the ID of the chosen option.
Choose Steps
Choose steps present a list of options. Select one by its ID:
{
"session": "session-id-here",
"company_name": "mycompany",
"procedure_name": "MYPROCEDURE",
"procedure_type": "P",
"step_type": "choose",
"action": {
"selected_option": "2"
}
}
Warning Steps
Warning steps display a message that must be acknowledged before the procedure continues:
{
"session": "session-id-here",
"company_name": "mycompany",
"procedure_name": "MYPROCEDURE",
"procedure_type": "P",
"step_type": "warning",
"action": {
"acknowledged": true
}
}
Output Steps
When a report is ready (newsaved or askprint step), choose the output format:
{
"session": "session-id-here",
"company_name": "mycompany",
"procedure_name": "MYREPORT",
"procedure_type": "R",
"step_type": "askprint",
"action": {
"selected_format": "pdf",
"mode": "display",
"pdf": true
}
}
Mode options:
display– View the outputsignature– Generate with digital signatureautomail– Send via email
Background Processing
waitprocess and waitexecution steps indicate the server is processing in the background. Call procedure_continue again with the same step type to poll:
{
"session": "session-id-here",
"company_name": "mycompany",
"procedure_name": "MYPROCEDURE",
"procedure_type": "P",
"step_type": "waitprocess",
"action": {}
}
Keep polling until the step_type in the response changes to something else (e.g., end, displayurl, or another step).
Complete Example
The following example runs the ORDERSBYCUST report (Orders by Customer).
Step 1: Start the report
{
"procedure_name": "ORDERSBYCUST",
"procedure_type": "P",
"company_name": "test"
}
Response: newsaved step – choose a report format.
Step 2: Select format
{
"session": "netgate-v3-...",
"company_name": "test",
"procedure_name": "ORDERSBYCUST",
"procedure_type": "P",
"step_type": "newsaved",
"action": {
"selected_format": "-101",
"mode": "display",
"pdf": true
}
}
Response: input step – date range and open-orders flag.
Step 3: Provide date parameters
{
"session": "netgate-v3-...",
"company_name": "test",
"procedure_name": "ORDERSBYCUST",
"procedure_type": "P",
"step_type": "input",
"action": {
"fields": [
{ "id": 1, "operator": "=", "value": "01/01/26", "type": "date8" },
{ "id": 2, "operator": "=", "value": "23/08/26", "type": "date8" },
{ "id": 3, "operator": "=", "value": "Y", "type": "char" }
]
}
}
Response: another input step – customer/order/part filters.
Step 4: Provide filter parameters
{
"session": "netgate-v3-...",
"company_name": "test",
"procedure_name": "ORDERSBYCUST",
"procedure_type": "P",
"step_type": "input",
"action": {
"fields": [
{ "id": 1, "operator": "=", "value": "*", "type": "char" },
{ "id": 2, "operator": "=", "value": "*", "type": "char" },
{ "id": 3, "operator": "=", "value": "", "type": "char" },
{ "id": 4, "operator": "=", "value": "", "type": "char" }
]
}
}
Response: end step with the report URL.
Step 5: Result
The response includes:
- A URL to the generated report (HTML format)
- If the report content is small enough, it is included inline in the response
- If the content exceeds the size limit, only the URL is provided with a note indicating the content was omitted due to size
URL: https://p.priority-connect.online/html/priority/netfiles/.../report.htm