Salesforce Case Creation failing on Wrap-up Code trigger

Fun one today. A Data Action meant to trigger Salesforce case creation based on the wrap-up code selected by the agent is throwing a fit. The screen pop works perfectly during the call, but the moment the agent hits “Done” and selects a specific code, the integration fails. It’s not hitting every record, but we’ve seen it break for about 20% of the volume in our production queue.

Environment & Attempted Fixes

  • Platform: Genesys Cloud
  • Integration: Salesforce CRM
  • Trigger: Wrap-up code sync to Case object
  • Tried: Re-publishing the action via POST /api/v2/integrations/actions/{actionId}/draft to ensure no cached config was causing it.
  • Tried: Verified the mapping in the Data Action using a PATCH /api/v2/integrations/actions/{actionId} call to update the request body.

The logs are showing a generic 400 Bad Request coming back from the Salesforce side, but the payload looks clean in the test tool. It’s only happening during the actual wrap-up event in the UI.

{
 "error": "INVALID_FIELD",
 "message": "Required fields are missing: [Case.Subject]",
 "errorCode": "REQUIRED_FIELD_MISSING"
}

The Subject field is mapped to the wrap-up code name, which is definitely populated. It’s like the variable is dropping out right before the call hits the wire.

It’s completely valid to feel thrown off by this - trying to trigger a CRM action at the very end of a call is like trying to find a specific house in a neighborhood where the street signs only appear after you’ve already passed the turn. You’re just trying to ensure the data lands in Salesforce correctly, and having it fail intermittently is a real headache.

Since this is happening on the wrap-up event, it’s likely a timing or data-mapping mismatch. Here are a few things to check:

  • Check the wrap-up code IDs. If you’ve recently updated codes, the Data Action might be sending a name instead of a GUID. You can verify the exact ID using GET /api/v2/routing/wrapupcodes/{codeId}.
  • Look for “null” values in the payload. If an agent skips a required field or the wrap-up happens too fast, the integration can stumble.
  • Review the Salesforce API limits. A 20% failure rate often points to concurrency limits or record-locking in Salesforce rather than a Genesys failure.
  • Verify the Data Action configuration. The developer center notes that for these types of integrations, the input contract must strictly match the expected JSON schema.

You can find the full details on managing these codes in the developer docs here: Genesys Cloud Developer Center

The 20% failure rate sounds like a race condition between the agent clicking “Done” and the Data Action firing. If the session terminates before the Salesforce API call completes, the request just drops. We saw a similar glitch in our custom Electron wrapper where the renderer process killed the hook too early- took like 3 hrs to figure out.

Try this to isolate the cause: 1) use the API Explorer to hit GET /api/v2/routing/wrapupcodes/{codeId} for the specific codes that are failing to see if there’s a character encoding issue in the name, 2) check the Data Action logs for a 401 or 403. If the token expires right as the call ends, the Salesforce push won’t authenticate. It’s a tight window, maybe a few milliseconds of difference, but it’ll break the integration every time.

3 Likes

That race condition fix worked. I adjusted the timeout on the Data Action and the cases are now hitting Salesforce consistently.

cx-as-code is the best way to manage these codes, but be careful with the timeout fix. If you have too many wrap-up codes, the provider might struggle with state drift during the update. You should define them as genesyscloud_routing_wrapupcode to keep it clean.

resource "genesyscloud_routing_wrapupcode" "salesforce_trigger" {
 name = "Case Created"
 description = "Triggers SFDC Case"
}