Delete Supplier

Delete Supplier Mutation

Deletes an existing supplier entity from the system.

Arguments

Name
Type
Description

id

ID!

The ID of the supplier to delete

Return Type

SupplierDeletePayload! - Confirmation of the delete operation.

Return Fields

SupplierDeletePayload:

Field
Type
Description

deletedID

ID

The ID of the deleted supplier

Usage Example

mutation {
  deleteSupplier(id: "supp_123456789") {
    deletedID
  }
}

JavaScript Example

Important Considerations

Soft vs Hard Delete

The pyck system implements soft deletes by default, meaning:

  • The supplier record is marked as deleted (deletedAt timestamp is set)

  • The supplier data remains in the database for audit purposes

  • The supplier will not appear in normal queries

  • Related data (purchase orders, receiving records) remains intact

Data Integrity

Before deleting a supplier, consider:

  • Active Purchase Orders: Check if the supplier has pending or active orders

  • Outstanding Invoices: Verify all supplier invoices are processed

  • Inventory Dependencies: Consider items that depend on this supplier

  • Contract Obligations: Ensure deletion doesn't violate supplier agreements

  • Related Records: Consider impact on receiving history and payments

Supply Chain Impact

Supplier deletion affects:

  • Procurement Planning: Future sourcing strategies

  • Inventory Management: Replenishment planning for supplier-specific items

  • Cost Analysis: Historical cost tracking and analysis

  • Quality Records: Supplier performance and quality history

Permissions

Supplier deletion typically requires:

  • Administrative or procurement management privileges

  • Proper authorization for the tenant/organization

  • Compliance with procurement policies and audit requirements

Error Scenarios

The mutation may fail in these cases:

  • Not Found: Supplier ID doesn't exist

  • Permission Denied: Insufficient privileges to delete suppliers

  • Constraint Violations: Supplier has dependent records that prevent deletion

  • Business Rules: Custom business logic prevents deletion (e.g., active contracts)

  • Financial Obligations: Outstanding payments or invoices prevent deletion

Best Practices

  1. Pre-Delete Validation: Check for dependencies before deletion

  2. Stakeholder Notification: Inform procurement and operations teams

  3. Data Export: Back up supplier information before deletion

  4. Alternative Sourcing: Identify replacement suppliers if needed

  5. Audit Documentation: Document reasons for supplier removal

  6. Compliance Check: Ensure deletion meets regulatory requirements

Alternative Approaches

Instead of deletion, consider:

  • Deactivation: Mark supplier as inactive rather than deleting

  • Status Change: Move to "discontinued" or "blacklisted" status

  • Archiving: Archive old suppliers while maintaining history

  • Replacement: Replace with new supplier while maintaining relationships

After supplier deletion, you may need to:

  • Update inventory item sourcing information

  • Modify purchase order templates

  • Adjust procurement workflows

  • Update supplier performance reports

  • Revise vendor management dashboards

Recovery

If a supplier is accidentally deleted:

  • Contact system administrators immediately

  • Soft deletes can typically be reversed by clearing the deletedAt timestamp

  • Hard deletes may require restoration from backups

  • Re-establish supplier relationships and data as needed

Last updated

Was this helpful?