Enhance documentation and workflow management in EspoCRM

- Update README.md to include a table of contents and detailed sections on workflow management and custom scripts.
- Remove deprecated 'runWorkflow' field from CVmhErstgespraech localization files.
- Add 'runWorkflow' field to detail layout for CVmhErstgespraech.
- Update workflow_manager.php to improve workflow listing and management functionality.
- Adjust cache timestamps in config.php.
- Create CUSTOM_DIRECTORY.md to outline the custom directory structure and best practices.
- Add README.md for workflow definitions with usage examples and JSON format specifications.
- Introduce new workflow definitions for 'vmh-erstberatung-abschließen' and its backup.
This commit is contained in:
2026-01-20 23:58:29 +01:00
parent e878125489
commit 8c83e54650
12 changed files with 637 additions and 70 deletions

View File

@@ -0,0 +1,70 @@
# Workflow Definitions
This directory contains workflow definitions in JSON format that can be imported into EspoCRM using the workflow manager script.
## File Format
### Simple Workflow
```json
{
"type": "simple",
"name": "workflow-name",
"entity_type": "EntityName",
"trigger_type": "afterRecordSaved",
"is_active": true,
"description": "Description of what this workflow does",
"conditions_all": [],
"conditions_any": [],
"conditions_formula": null,
"actions": []
}
```
**Trigger Types:**
- `afterRecordSaved` - After record is created or updated
- `afterRecordCreated` - Only after record is created
- `scheduled` - Runs on a schedule
**Condition Types:**
- `equals`, `notEquals`, `greaterThan`, `lessThan`, `contains`, `notContains`, `isEmpty`, `isNotEmpty`, `isTrue`, `isFalse`, `wasEqual`, `wasNotEqual`, `changed`, `notChanged`
**Action Types:**
- `sendEmail` - Send email to recipient
- `createEntity` - Create a new record
- `updateEntity` - Update current record
- `relateTo` - Link to another record
- `unrelateFrom` - Unlink from record
- `applyAssignmentRule` - Apply assignment rules
- `createNotification` - Create notification
### BPM Flowchart
```json
{
"type": "bpm",
"name": "flowchart-name",
"target_type": "EntityName",
"is_active": true,
"description": "Description",
"data": {
"list": []
},
"elements_data_hash": {},
"event_start_all_id_list": []
}
```
## Usage
Import a workflow:
```bash
docker exec espocrm php /var/www/html/custom/scripts/workflow_manager.php import /var/www/html/custom/workflows/your-workflow.json
```
Export a workflow:
```bash
docker exec espocrm php /var/www/html/custom/scripts/workflow_manager.php export <workflow-id> /var/www/html/custom/workflows/exported.json
```
## Examples
- `vmh-erstberatung-abschliessen.json` - Sends email and sets status when consultation is completed

View File

@@ -0,0 +1,43 @@
{
"type": "simple",
"name": "vmh-erstberatung-abschlie\u00dfen",
"entity_type": "CVmhErstgespraech",
"trigger_type": "afterRecordSaved",
"is_active": true,
"description": "Versendet Erstberatungs-E-Mail und setzt Status auf \"Warte auf Mandatierung\"",
"conditions_all": [
{
"comparison": "equals",
"subjectType": "value",
"cid": 0,
"fieldToCompare": "status",
"type": "all",
"value": "Warte auf Mandatierung"
},
{
"comparison": "changed",
"subjectType": null,
"cid": 1,
"fieldToCompare": "status",
"type": "all"
}
],
"conditions_any": [],
"conditions_formula": null,
"actions": [
{
"type": "sendEmail",
"cid": 0,
"id": "423a120400",
"from": "specifiedEmailAddress",
"fromEmailAddress": "anwalt@vermieterhelden.de",
"to": "targetEntity",
"toEmailAddress": null,
"replyTo": null,
"emailTemplateId": null,
"emailTemplateName": null,
"doNotStore": false,
"optOutLink": false
}
]
}

View File

@@ -0,0 +1,27 @@
{
"type": "simple",
"name": "vmh-erstberatung-abschließen",
"entity_type": "CVmhErstgespraech",
"trigger_type": "afterRecordSaved",
"is_active": true,
"description": "Sendet E-Mail und setzt Status wenn Erstberatung abgeschlossen wird",
"conditions_all": [
{
"type": "equals",
"attribute": "status",
"value": "Warte auf Mandatierung"
}
],
"conditions_any": [],
"conditions_formula": null,
"actions": [
{
"type": "sendEmail",
"from": "system",
"to": "contactId",
"emailTemplateId": null,
"subject": "Erstberatung abgeschlossen",
"body": "Ihre Erstberatung wurde erfolgreich abgeschlossen. Wir warten nun auf Ihre Mandatierung."
}
]
}