Processes
The Processes section within a Module exposes global process actions—custom actions that are not bound to a specific entity. These are standalone operations that can work across multiple entities or perform system-level functions.
Global Process Actions
Global Process Actions expose Dynamics 365 custom actions (process actions) that are not entity-bound. They provide a way to execute complex business logic through a simple API call.
Global Process Action Structure
┌─────────────────────────────────────────────────────────────────────┐
│ GLOBAL PROCESS ACTION STRUCTURE │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ DEFINITION │ │
│ │ • Name (action identifier) │ │
│ │ • Process Action (CRM custom action to invoke) │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ DOCUMENTATION │ │
│ │ • Title │ │
│ │ • Description │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ INPUTS │ │
│ │ • API input parameters │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ OUTPUTS │ │
│ │ • Response fields returned to caller │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ DATA FETCHER │ │
│ │ • Pre-fetch queries for validation │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ ACCESS CONTROL │ │
│ │ • Authorization Policy │ │
│ │ • Pre-conditions │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ PROCESS ACTION BINDING │ │
│ │ • Input Arguments (mapping API inputs to process) │ │
│ │ • Output Arguments (mapping process outputs to response) │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘
Configuration Components
Definition
| Property | Required | Description |
|---|---|---|
| Name | Yes | Unique identifier for this process action (e.g., "calculate-discount", "run-credit-check") |
| Endpoint Name | Yes | The URL path segment for invoking this action |
| Process Action | Yes | The Dynamics 365 custom action to invoke |
Documentation
| Property | Required | Description |
|---|---|---|
| Title | Yes | Short, descriptive name (e.g., "Calculate Discount", "Run Credit Check") |
| Description | No | Detailed explanation of what the action does, its effects, and expected behavior |
Inputs
| Property | Description |
|---|---|
| Name | Parameter identifier used in API request |
| Type | Data type (String, Integer, Money, DateTime, GUID, etc.) |
| Required | Whether the parameter must be provided |
| Default Value | Value used if parameter is not provided |
| Validation | Validation rules |
| Description | Documentation for API consumers |
Outputs
| Property | Description |
|---|---|
| Name | Field name in the API response |
| Type | Data type for serialization |
| Description | Documentation explaining the output |
Process Action Binding
Input Arguments: Maps API inputs to the custom action's input parameters.
| Property | Description |
|---|---|
| Process Argument | The custom action's input parameter name |
| Binding | The API input, fetched data, or expression to use |
Output Arguments: Maps the custom action's output parameters to the API response.
| Property | Description |
|---|---|
| Process Argument | The custom action's output parameter name |
| Response Field | The field name in the API response |
| Transform | Optional transformation before returning |
Examples
Example 1: Apply Discount Code
Module: Sales
Global Process Action: ApplyDiscountCode
┌─────────────────────────────────────────────────────────────────────┐
│ DEFINITION │
├─────────────────────────────────────────────────────────────────────┤
│ Name: apply-discount │
│ Endpoint: POST /api/sales/processes/apply-discount │
│ Process Action: new_ApplyDiscountCode │
└─────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────┐
│ INPUTS │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌───────────────┬──────────┬──────────┬─────────────────────────┐ │
│ │ Name │ Type │ Required │ Description │ │
│ ├───────────────┼──────────┼──────────┼─────────────────────────┤ │
│ │ orderId │ GUID │ Yes │ Order to apply discount │ │
│ ├───────────────┼──────────┼──────────┼─────────────────────────┤ │
│ │ discountCode │ String │ Yes │ Discount code │ │
│ └───────────────┴──────────┴──────────┴─────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘
API Request:
POST /api/sales/processes/apply-discount
Content-Type: application/json
Authorization: Bearer {token}
{
"orderId": "order-guid-here",
"discountCode": "SUMMER2024"
}
Example 2: Run Credit Check
Module: Sales
Global Process Action: RunCreditCheck
┌─────────────────────────────────────────────────────────────────────┐
│ DEFINITION │
├─────────────────────────────────────────────────────────────────────┤
│ Name: credit-check │
│ Endpoint: POST /api/sales/processes/credit-check │
│ Process Action: new_RunCreditCheck │
└─────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────┐
│ INPUTS │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌───────────────┬──────────┬──────────┬─────────────────────────┐ │
│ │ Name │ Type │ Required │ Description │ │
│ ├───────────────┼──────────┼──────────┼─────────────────────────┤ │
│ │ accountId │ GUID │ Yes │ Account to check │ │
│ ├───────────────┼──────────┼──────────┼─────────────────────────┤ │
│ │ checkType │ String │ No │ "soft" or "hard" │ │
│ ├───────────────┼──────────┼──────────┼─────────────────────────┤ │
│ │ forceRefresh │ Boolean │ No │ Force new check │ │
│ └───────────────┴──────────┴──────────┴─────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘
API Request:
POST /api/sales/processes/credit-check
Content-Type: application/json
Authorization: Bearer {token}
{
"accountId": "account-guid-here",
"checkType": "soft",
"forceRefresh": false
}
Example 3: Generate Report
Module: Reports
Global Process Action: GenerateReport
┌─────────────────────────────────────────────────────────────────────┐
│ DEFINITION │
├─────────────────────────────────────────────────────────────────────┤
│ Name: generate-report │
│ Endpoint: POST /api/reports/processes/generate │
│ Process Action: new_GenerateSalesReport │
└─────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────┐
│ INPUTS │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌───────────────┬──────────┬──────────┬─────────────────────────┐ │
│ │ Name │ Type │ Required │ Description │ │
│ ├───────────────┼──────────┼──────────┼─────────────────────────┤ │
│ │ reportType │ String │ Yes │ "sales-summary", │ │
│ │ │ │ │ "pipeline", "forecast" │ │
│ ├───────────────┼──────────┼──────────┼─────────────────────────┤ │
│ │ startDate │ DateTime │ Yes │ Report start date │ │
│ ├───────────────┼──────────┼──────────┼─────────────────────────┤ │
│ │ endDate │ DateTime │ Yes │ Report end date │ │
│ ├───────────────┼──────────┼──────────┼─────────────────────────┤ │
│ │ format │ String │ No │ "pdf", "xlsx", "csv" │ │
│ └───────────────┴──────────┴──────────┴─────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘
API Request:
POST /api/reports/processes/generate
Content-Type: application/json
Authorization: Bearer {token}
{
"reportType": "sales-summary",
"startDate": "2024-01-01T00:00:00Z",
"endDate": "2024-06-30T23:59:59Z",
"format": "pdf"
}
API Response
Success (200 OK):
{}
Note: Process actions typically return an empty response body on success. The 200 status code indicates the operation completed successfully.
Error Responses
Bad Request - Invalid Input (400):
{
"errorCode": "VALIDATION_ERROR",
"errorMessage": "Invalid discount code"
}
Bad Request - Business Rule Violation (400):
{
"errorCode": "BUSINESS_RULE_VIOLATION",
"errorMessage": "Order total does not meet minimum amount for this discount code"
}
Unauthorized (401):
{
"errorCode": "UNAUTHORIZED",
"errorMessage": "You do not have permission to perform this action"
}
Internal Server Error (500):
{
"errorCode": "INTERNAL_ERROR",
"errorMessage": "An unexpected error occurred while processing the request"
}
Best Practices
Design
- Use clear, action-oriented names (e.g., "calculate-discount" not "discount")
- Define comprehensive input validation in pre-conditions
- Document expected outputs clearly
- Consider idempotency where appropriate
Security
- Use appropriate authorization policies based on action sensitivity
- Validate all inputs before passing to the process action
- Consider rate limiting for expensive operations (credit checks, report generation)
Pre-conditions
- Validate all required data exists before invoking the process
- Check quotas and limits before performing costly operations
- Provide clear, actionable error messages
Outputs
- Return all relevant information the caller needs
- Include status indicators (applied, cached, etc.)
- Provide metadata (dates, counts, sizes) for UI display