Snippets Collections
IF(
  CONTAINS({!$Flow.FaultMessage}, "REQUIRED_FIELD_MISSING"),
  MID(
    {!$Flow.FaultMessage},
    FIND("REQUIRED_FIELD_MISSING: ", {!$Flow.FaultMessage}) + LEN("REQUIRED_FIELD_MISSING: "),
    FIND(". You can look up ExceptionCode values in the", {!$Flow.FaultMessage}) - FIND("REQUIRED_FIELD_MISSING: ", {!$Flow.FaultMessage}) - LEN("REQUIRED_FIELD_MISSING: ")
  ),
  IF(
    CONTAINS({!$Flow.FaultMessage}, "FIELD_CUSTOM_VALIDATION_EXCEPTION"),
    MID(
      {!$Flow.FaultMessage},
      FIND("FIELD_CUSTOM_VALIDATION_EXCEPTION: ", {!$Flow.FaultMessage}) + LEN("FIELD_CUSTOM_VALIDATION_EXCEPTION: "),
      FIND(". You can look up ExceptionCode values in the", {!$Flow.FaultMessage}) - FIND("FIELD_CUSTOM_VALIDATION_EXCEPTION: ", {!$Flow.FaultMessage}) - LEN("FIELD_CUSTOM_VALIDATION_EXCEPTION: ")
    ),
    IF(
      CONTAINS({!$Flow.FaultMessage}, "_EXCEPTION"),
      MID(
        {!$Flow.FaultMessage},
        FIND("_EXCEPTION: ", {!$Flow.FaultMessage}) + LEN("_EXCEPTION: "),
        FIND(". You can look up ExceptionCode values in the", {!$Flow.FaultMessage}) - FIND("_EXCEPTION: ", {!$Flow.FaultMessage}) - LEN("_EXCEPTION: ")
      ),
      {!$Flow.FaultMessage}
    )
  )
)



/*

For "REQUIRED_FIELD_MISSING" error:

MID({!$Flow.FaultMessage}, FIND('REQUIRED_FIELD_MISSING: ', {!$Flow.FaultMessage}) + LEN('REQUIRED_FIELD_MISSING: '), FIND('. You can look up ExceptionCode values in the', {!$Flow.FaultMessage}) - FIND('REQUIRED_FIELD_MISSING: ', {!$Flow.FaultMessage}) - LEN('REQUIRED_FIELD_MISSING: '))


For "_EXCEPTION" endigns (i.e, "FIELD_CUSTOM_VALIDATION_EXCEPTION"):

MID({!$Flow.FaultMessage}, FIND('_EXCEPTION: ', {!$Flow.FaultMessage}) + LEN('_EXCEPTION: '), FIND('. You can look up ExceptionCode values in the', {!$Flow.FaultMessage}) - FIND('_EXCEPTION: ', {!$Flow.FaultMessage}) - LEN('_EXCEPTION: '))

// Note there are many other exceptions that don't fall into these 2 types. Check the developer guide and make sure the full error is displayed of not found.

// The "SOAP API Developer Guide" is a hyperlink - that's why it's not part of the formula


*/
star

Thu Jan 16 2025 04:06:41 GMT+0000 (Coordinated Universal Time) https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_concepts_core_data_objects.htm#

#salesforce #screnflow #formulas

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension