Recipe API update fails with 'locked formulation' error when modifying approved recipes

Our automated recipe update process is failing with a ‘locked formulation’ error when attempting to modify approved recipes via the Java API. We’re on Agile PLM 9.3.5, integrating with an external formulation system that pushes recipe updates.

The error occurs when trying to update recipe attributes:


APIException: Cannot modify locked formulation
at RecipeObject.setValue(RecipeObject.java:445)
Status: APPROVED, Workflow State: Released

The recipe status validation seems to prevent any modifications once a recipe reaches approved status. Our business process requires updating certain non-critical attributes (like manufacturing notes or shelf life) even after approval. Is there a way to bypass this lock or use a different API method that allows updates to approved recipes? The integration with our external ERP system depends on this capability.

Have you looked into configuring which attributes are editable in approved status? In the recipe management module configuration, you can define attribute-level permissions that allow certain fields to be modified even when the recipe is locked. This might be cleaner than changing status back and forth.

This is standard behavior in Agile PLM’s recipe management. Once a recipe is approved, it’s locked to prevent unauthorized changes. You’ll need to change the status first, make your updates, then re-approve. Check if your integration account has the proper privileges to modify workflow states.

I’ve implemented several external system integrations with Agile PLM recipe management, and here’s the comprehensive solution addressing all three focus areas:

1. Recipe Status Validation: The API enforces strict status-based locking. Before any update, you must validate the current recipe status and workflow state. The key is understanding which statuses allow modifications in your configuration.

2. Java API Status Change Methods: Implement a controlled status change workflow:

IRecipe recipe = (IRecipe) session.getObject(IRecipe.OBJECT_TYPE, recipeNum);
IStatus currentStatus = recipe.getStatus();
if (currentStatus.equals("Approved")) {
  recipe.changeStatus("In_Modification");
  recipe.setValue(RecipeConstants.ATT_NOTES, updatedNotes);
  recipe.changeStatus("Approved");
}

3. Integration with External Systems: For ERP integration, implement a queue-based update mechanism. Your external system should submit update requests to a staging table or message queue. A scheduled Agile PLM integration service processes these requests with proper status handling.

The critical insight is that you need to distinguish between attributes that require full change control (formulation quantities, ingredients) versus administrative attributes (notes, dates). Configure your recipe class to allow specific attributes to remain editable in approved status through Admin > Data Settings > Classes.

Alternatively, implement a custom privilege class that grants your integration service account permission to modify locked recipes. This requires careful security configuration but provides the cleanest API experience.

For your ERP integration specifically, I recommend creating a dedicated ‘System Update’ workflow path that allows automated modifications without full re-approval. This workflow should have accelerated approval routing or auto-approval for non-critical changes.

Implement robust error handling in your integration layer. When the API throws the locked formulation exception, your code should evaluate whether the update qualifies for the system update path or requires full change control. Log all attempts and outcomes for audit purposes.

One final consideration: ensure your external system timestamps are synchronized with Agile PLM. Status change operations can fail if there are timing conflicts or concurrent modification attempts.

The ‘locked formulation’ error is actually a feature, not a bug. It ensures that approved recipes maintain their integrity. However, I understand your use case for updating non-critical data. Consider using the ECO (Engineering Change Order) process through the API to make controlled updates. This creates an audit trail and maintains compliance while allowing the modifications you need.

From an integration architecture perspective, you need to consider the implications of modifying approved recipes. Even non-critical attributes might have regulatory or compliance significance in formulation management. Make sure your external system integration respects the change control process. You might want to implement a change request workflow that creates a recipe revision rather than modifying the approved version directly.