PR Create: Based on Fairmarkit Request
Process Diagram
sequenceDiagram
actor ERP_User as Business User
participant ERP_System as ERP/P2P System
participant ERP_Middleware as ERP Middleware
participant Fairmarkit_API as Fairmarkit Public API
participant Fairmarkit_APP as Fairmarkit System
# note over ERP_User: PR Intercept and Create flows via Public API
rect rgb(125,125,125,.2)
note over ERP_User,Fairmarkit_APP: PR Create from Request (via API)
note right of ERP_User: 1. Creates a new Request in the Fairmarkit.
ERP_User->>Fairmarkit_APP: -
Fairmarkit_APP-->>Fairmarkit_APP: -
note over Fairmarkit_APP: 1. Validates the data.<br>2. Creates the request in Fairmarkit’s database.
note right of ERP_User: 1. Reviews the request and submits.<br>2. Depending on automation rules or manual action,<br>the Purchase Requisition (PR) creation flow starts.
ERP_User->>Fairmarkit_APP: -
Fairmarkit_APP-->>Fairmarkit_APP: -
note over Fairmarkit_APP: 1. Processes the data, changes the status.<br>2. Sends the webhook notification.
Fairmarkit_APP ->> Fairmarkit_API: **WEBHOOK** event **AWAITING_PR_CREATE**
Fairmarkit_API ->> ERP_Middleware: **WEBHOOK** event **AWAITING_PR_CREATE**
ERP_Middleware-->>ERP_Middleware: -
note over ERP_Middleware: 1. Parses the payload,<br>2. Logs the data.<br>3. Enriches data if needed.<br>4. Prepares payload needed for<br> the PR creation in the ERP.
alt successful case
ERP_Middleware ->> ERP_System: Makes an internal "Create PR" call.
ERP_System-->>ERP_System: -
note over ERP_System: 1. Creates new PR locally.<br>2. Triggers Approvals.<br>...<br>n.etc...
ERP_System -->> ERP_Middleware: Response: details of the newly created PR
ERP_Middleware ->> Fairmarkit_API: **POST** /self-service/api/v3/requests/{uuid}/pr/link/
Fairmarkit_API ->> Fairmarkit_APP: Calls the internal API call to link PR and RFQ
note over Fairmarkit_APP: 1. Adds the link to the<br>newly created PR.<br>2. Changes the status of<br>the request to completed.
Fairmarkit_APP-->>Fairmarkit_APP: -
Fairmarkit_APP ->> Fairmarkit_API: **WEBHOOK** event **REQUEST_COMPLETED**
Fairmarkit_API ->> ERP_Middleware: **WEBHOOK** event **REQUEST_COMPLETED**
ERP_Middleware-->>ERP_Middleware: -
note over ERP_Middleware: 1. Parses the payload.<br>2. Logs the data.<br>3. Enriches data if needed.<br>
else error case
ERP_Middleware-->>ERP_Middleware: -
note over ERP_Middleware: 1. Data validation Failed or PR Creation process failed
ERP_Middleware ->> Fairmarkit_API: **POST** /self-service/api/v3/requests/{uuid}/pr/mark-as-failed/
Fairmarkit_API ->> Fairmarkit_APP: Calls the internal API to store Error details
note over Fairmarkit_APP: 1. Adds errors to the<br>newly created PR.
Fairmarkit_APP-->>Fairmarkit_APP: -
note over Fairmarkit_APP: 1. Changes Request status to draft<br>to allow user to provide changes.
Fairmarkit_APP-->>Fairmarkit_APP: -
end
opt
note right of ERP_User: 1. Works with the PR and do some changes (e.g. status).
ERP_User->>ERP_System: -
ERP_System -->> ERP_Middleware: Notify middleware on the PR status update
ERP_Middleware ->> Fairmarkit_API: **POST** /self-service/api/v3/requests/{uuid}/pr/status/
Fairmarkit_API ->> Fairmarkit_APP: Calls the internal API to store the Status Update
note over Fairmarkit_APP: 1. Stores the PR status update
Fairmarkit_APP-->>Fairmarkit_APP: -
end
end
Process Flow
- User creates a request in the Fairmarkit (FM) application.
- Optional: Price-book Automation can identify the product by title. The user can confirm or reject the Price-Book search result
- User reviews the request and clicks the Create Purchase Requisition button.
- User selects a Supplier from the available list. In the case of the Price-book Automation, the supplier is already selected on the Pop-Up.
- Fairmarkit app triggers a webhook and sends the request to the pre-configured endpoint. The event name -REQUEST_AWAITING_PR_CREATE
- Fairmarkit is blocking the Request from editing in "Creating PR" status and is waiting for the API Calls from the target ERP System.
- Target ERP System or ERP Middleware parses the payload and attempts to create a Purchase Requisition (PR).
- If the PR is created successfully:
- ERP Middleware should make an API call to Fairmarkit with the details of the newly created PR via /api/v3/requests/:request_id/pr/link/
- In this case Request on the Fairmarkit side is changing status to "Completed".
- Fairmarkit app triggers a webhook and sends the request to the pre-configured endpoint. The event name -REQUEST_COMPLETED
- The user continues to work with the PR directly in the ERP system.
- Optional: ERP Middleware can detect updates in the ERP system and send these updates to Fairmarkit via /api/v3/requests/:request_id/pr/status/
- If an error occurs:
- ERP Middleware can make an API call to Fairmarkit with all the error details: /api/v3/requests/:request_id/pr/mark-as-failed/
- In this case, the Request on the Fairmarkit side returns to the "Draft" status for editing.
- After editing user can try to create a PR one more time (step #3)
Updated 19 days ago
