Share via

Copilot interpreting 201 Status Code from Create Salesforce Record Connector as error

Anthony Whitford 5 Reputation points
2026-01-09T06:44:13.64+00:00

I am using Copilot Studio to build an AI Agent.
This agent creates Account records in Salesforce.
I am using the Salesforce Create Record connector.

The logic basically works except that Copilot is misinterpreting the 201 HTTP Status Code as an error. According to the Salesforce documentation, a 201 Status Code is expected (and indicative of Success).

I tried adding to the Agent Instructions that a 201 HTTP Status Code is expected, but I still get the failure:

User's image

Microsoft Copilot | Microsoft 365 Copilot | Development

1 answer

Sort by: Most helpful
  1. Sayali-MSFT 5,771 Reputation points Microsoft External Staff Moderator
    2026-01-12T09:59:58.6733333+00:00

    Hello Anthony Whitford,
    Even though Salesforce correctly returns HTTP 201 Created for a successful record creation, Copilot Studio’s orchestration engine currently treats any HTTP status code ≠ 200 as an error, even when the connector marks 201 as a success condition.

    This is not something you can fix with agent instructions, because the error is raised before the LLM receives the response. Instructions cannot override connector-level error handling.

    This is a known product limitation affecting:

    • Salesforce “Create Record”
    • Custom API plugins returning 201
    • Power Automate connector actions wrapped inside an agent tool
    • Some REST operations that correctly follow HTTP spec

    Salesforce is behaving correctly: its REST API explicitly returns 201 Created for successful POST /sobjects/<object> calls, including a response body with id, success: true, and no errors. The problem lies in Copilot Studio, whose Salesforce connector expects 200 OK and treats other success codes (201, 202, 204) as connectorRequestFailure, failing the tool call before the LLM can process the response and offering no override mechanism.

    Working solutions include:

     **Power Automate Flow (recommended):** Wrap the Salesforce create call in a flow triggered by the agent. Power Automate correctly handles 201 as success and returns a clean success payload to Copilot Studio.
     
        **SOQL-based Upsert:** May return 200 OK, but requires an external ID and changes logic.
        
           **Custom API Plugin:** Full control over response mapping, but adds OAuth, security, and maintenance overhead.
           
    

    Non-working approaches (for clarity): instructions to treat 201 as success, grounding/action tweaks, connector config changes, or editing the built-in connector schema.

    Recommendation: For production, use Power Automate to normalize non-200 success codes—this aligns with Microsoft’s guidance.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.