Your issue stems from incomplete API object creation that doesn’t establish the policy context required for lifecycle state transitions. Here’s the comprehensive solution addressing all three focus areas:
Policy Assignment:
When creating Parts via REST API, you must explicitly assign a policy. Modify your POST request to include policy information:
POST /enovia/resources/v1/modeler/parts
{
"type": "Part",
"name": "PART-12345",
"policy": "EC Part",
"current": "Preliminary"
}
The ‘policy’ field specifies which lifecycle policy governs the object, and ‘current’ sets the initial state. Without both, ENOVIA creates an unmanaged object that cannot participate in lifecycle workflows.
API Object Creation:
For robust API object creation with proper policy assignment, implement this pattern:
- Query available policies: Before creating objects, retrieve valid policies for the Part type:
GET /enovia/resources/v1/modeler/types/Part/policies
This returns policies accessible to your API user. Select an appropriate policy based on your part classification (prototype, production, etc.).
- Verify policy states: Each policy defines specific states. Query the policy details:
GET /enovia/resources/v1/modeler/policies/EC%20Part
The response shows available states and transition rules. Always set ‘current’ to the policy’s initial state (typically the first state in the lifecycle).
- Complete creation payload: Include all required fields for policy-managed objects:
{
"type": "Part",
"name": "PART-12345",
"revision": "A",
"policy": "EC Part",
"current": "Preliminary",
"vault": "Engineering",
"owner": "api_service_account"
}
Vault and owner are critical - some policies restrict object creation to specific vaults or require owner assignment for proper access control during lifecycle transitions.
Lifecycle State Transition:
Once objects are created with proper policy assignment, state transitions work correctly:
- Promotion request structure:
POST /enovia/resources/v1/modeler/parts/{objectId}/promote
{
"action": "Promote",
"comments": "Ready for review"
}
- Validate transition eligibility: Before promoting, check if the object can transition:
GET /enovia/resources/v1/modeler/parts/{objectId}/nextStates
This returns valid next states based on the current state and policy rules. Only attempt transitions to states listed in this response.
- Handle signature requirements: Some state transitions require signatures or approvals. If your promotion fails with signature-required errors, you’ll need to complete approval workflows first:
POST /enovia/resources/v1/modeler/parts/{objectId}/signatures
{
"signatureType": "Approve",
"user": "approver_username"
}
- Error handling: Implement proper error handling for lifecycle operations:
try {
promotePart(partId);
} catch (PolicyException e) {
// Check if policy is assigned
// Verify current state is valid
// Ensure user has promotion rights
}
Best Practices for API-driven Lifecycle Management:
- Always retrieve and validate policy information before object creation
- Cache policy definitions to avoid repeated API calls
- Implement retry logic for transient failures during state transitions
- Log all lifecycle operations for audit and troubleshooting
- Use batch operations for multiple object promotions to improve performance
After implementing these changes, your API-created Parts will have proper policy assignments and lifecycle state transitions will execute successfully. The key is ensuring complete object initialization during creation rather than attempting to add policy context later.
This draft is based on general ENOVIA knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.