API call to transition object to obsolete state fails with validation error

We’re automating end-of-life processes and need to transition parts to Obsolete state via REST API. The lifecycle transition API payload seems correct, but I keep getting validation errors when trying to move parts from Released to Obsolete. The required fields for state change aren’t clearly documented for lifecycle transitions.

Here’s the API call:

POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:98765')/PTC.ProdMgmt.SetState
{
  "State": "OBSOLETE"
}

The validation error message is vague: “Cannot transition to target state - validation failed.” The REST vs UI behavior is noticeably different - in the UI, I can transition the same parts to Obsolete without any prompts or additional fields. What’s the API missing that the UI provides automatically?

Here’s the comprehensive solution addressing all three critical aspects:

1. Lifecycle Transition API Payload

The SetState action in Windchill 11.1 REST API requires more information than just the target state. The correct payload structure:

POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:98765')/PTC.ProdMgmt.SetState
{
  "State": "OBSOLETE",
  "Comment": "End of life - superseded by new model",
  "LifeCycleTemplate": "Standard Part Lifecycle"
}

Key points:

  • Comment field is mandatory for most lifecycle transitions, even if not enforced in lifecycle template configuration
  • LifeCycleTemplate parameter ensures correct template is used (critical if object type has multiple templates)
  • State value must match exact internal name (case-sensitive): “OBSOLETE” not “Obsolete”

If your transition requires intermediate states (e.g., Released → Deprecated → Obsolete), you must transition through each state sequentially. The API doesn’t support skipping intermediate states even if the lifecycle template allows it in UI.

2. Required Fields for State Change

Validation failures typically occur due to state-specific attribute requirements:

A. Lifecycle Template Configuration:

Navigate to Site > Utilities > Lifecycle Administrator. Select your lifecycle template and check the Obsolete state definition:

  • Required attributes: Any attributes marked required for Obsolete state must be populated before transition
  • Approval requirements: If Obsolete state requires approval, you must complete approval workflow first
  • Validation rules: Custom validation rules execute during transition and can block it

B. Common Required Fields for Obsolete Transition:

// Pseudocode - Complete transition payload:
1. Fetch current part object to verify current state
2. Build payload with mandatory fields:
   - State: target state name
   - Comment: reason for transition (100+ chars recommended)
   - ObsoleteReason: if custom IBA exists
   - ReplacementPart: reference to superseding part (if applicable)
3. Validate no active change orders reference the part
4. POST SetState action with complete payload
5. Verify transition success with GET request
// See documentation: Windchill Lifecycle API Guide Section 7.4

C. Dependency Validation:

Before transitioning to Obsolete, verify:

SELECT COUNT(*) FROM ChangeActivity2 ca
JOIN ChangeableLink2 cl ON ca.ida2a2 = cl.ida3a6
WHERE cl.ida3b4 = 98765 AND ca.statestate IN ('INWORK','UNDERREVIEW')

If count > 0, active change orders reference the part and block Obsolete transition. Complete or remove these references first.

3. REST vs UI Behavior Differences

The UI provides capabilities that REST API doesn’t automatically handle:

UI Advantages:

  • Wizard-based flow: UI presents multi-step wizard that collects required information progressively
  • Auto-population: UI automatically fills certain fields (modifier, modification timestamp) that API expects explicitly
  • Validation feedback: UI shows which specific fields are missing; API returns generic “validation failed”
  • Dependency resolution: UI can prompt to resolve dependencies (e.g., complete change orders); API just fails

REST API Requirements:

To achieve UI-equivalent functionality via API:

  1. Pre-transition validation:

    • Query object’s current state and lifecycle template
    • Fetch all required attributes for target state
    • Check for active dependencies (change orders, baselines, where-used)
    • Verify user has transition permission
  2. Complete payload construction:

    • Include all required fields explicitly
    • Add Comment even if not strictly required
    • Specify LifeCycleTemplate to avoid ambiguity
    • Include any custom IBA attributes that become required in target state
  3. Error handling:

    • Parse validation error details from MethodServer.log (API response is often generic)
    • Implement retry logic for transient failures
    • Provide meaningful error messages to end users

Common Gotchas in 11.1:

  • Workflow-driven transitions: If lifecycle template has workflow attached to Obsolete state, you must use different approach:

    POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:98765')/PTC.ProdMgmt.Promote
    {
      "Comment": "Initiating obsolescence workflow"
    }
    

    This starts workflow instead of direct state change.

  • Baseline references: Parts referenced in product baselines cannot transition to Obsolete until removed from baseline or baseline is marked historical

  • View management: If using view-managed parts, you must transition all view instances to maintain consistency

Debugging Steps:

  1. Enable lifecycle debug logging: `log4j.logger.wt.lifecycle=DEBUG
  2. Check MethodServer.log during failed transition for detailed validation messages
  3. Compare part’s lifecycle template in UI vs what API is using (might be using wrong template)
  4. Test transition in UI while monitoring logs to see what additional data UI provides
  5. Use Windchill REST API explorer to see full schema for SetState action

Complete Working Example:

POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:98765')/PTC.ProdMgmt.SetState
Content-Type: application/json

{
  "State": "OBSOLETE",
  "Comment": "Product discontinued - no longer manufactured. Superseded by part P-2025-NEW.",
  "LifeCycleTemplate": "Standard Part Lifecycle"
}

If this still fails, the issue is likely:

  1. Active change order references (resolve first)
  2. Custom validation rule in lifecycle template (check template configuration)
  3. Required custom IBA attribute for Obsolete state (check type definition)

Run the dependency query above and check lifecycle template configuration carefully. The validation error should disappear once all required fields and dependencies are addressed.


This draft is based on general Windchill knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.

Lifecycle transitions via REST API require more than just the target state. You need to check if your lifecycle template has mandatory fields or approval requirements for the Obsolete state. The UI might be auto-populating some fields that the API expects explicitly.

I’ve seen this before. The lifecycle transition API payload needs to include the lifecycle template name and sometimes the transition path. You can’t just specify target state - Windchill needs to know which transition path to follow if multiple paths exist to reach Obsolete. Try adding LifeCycleTemplate parameter to your payload.

I checked the lifecycle template and there’s only one path from Released to Obsolete, so multiple paths shouldn’t be the issue. Are there other required fields for state change that aren’t obvious? Maybe a reason code or comment field that’s mandatory for this transition?

Check if your lifecycle template has any workflow attached to the transition. If there’s a workflow that needs to complete before reaching Obsolete state, the REST API won’t automatically handle it like the UI does. You might need to complete the workflow separately before attempting the state transition. Also verify there are no validation rules on attributes that become required in Obsolete state - the API validates all required fields before allowing the transition.

There’s a difference in how UI and API handle lifecycle transitions. The UI uses a wizard that can prompt for additional information and handle intermediate states transparently. The REST API requires you to explicitly provide all necessary data upfront. For transitions to Obsolete, you typically need to specify the comment or reason, even if not technically required by the lifecycle template.

In 11.1, there’s also the issue of object maturity validation. Parts in Released state might have associated change orders, baselines, or other dependencies that prevent direct transition to Obsolete. The UI checks these and shows warnings, but the API just fails validation. You need to check for active change orders or usage links before attempting the transition.