CURL.SetFailedScript
--------------------

Sets which script to call when a transfer failed.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [14.0](newinversion140.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetFailedScript"; curl; FileName; ScriptName ) 

**MBS**( **"CURL.SetFailedScript";** /\* Sets which script to call when a transfer failed. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$FileName**; /\* The database file name where the script is located.e.g. "test.fmp12" \*/   
**$ScriptName**) /\* The script name.e.g. "MyScript" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| FileName | The database file name where the script is located. | "test.fmp12" |
| ScriptName | The script name. | "MyScript" |

### Result

Returns OK or error.

### Description

Sets which script to call when a transfer failed.  
Works with [CURL.Perform](CURLPerform.md), [CURL.PerformAsync](CURLPerformAsync.md) and [CURL.PerformInBackground](CURLPerformInBackground.md).  
  
Does not work on server due to missing capability to trigger scripts in the plugin SDK with FileMaker Server.  
  
The transfer is successful if [CURL.Perform](CURLPerform.md) internally returns no error. For http requests we also check response code for an error.  
### Examples

Set scripts to run on success or failure:

 # in case of success, trigger script to start next transfer   
Set Variable \[ $r ; Value: MBS ("[CURL.SetSucceededScript](CURLSetSucceededScript.md)"; $curl ; Get(FileName); "Transfer Success" ) \]  
  
\# in case of failure, trigger script to log error   
Set Variable \[ $r ; Value: MBS ("CURL.SetFailedScript"; $curl ; Get(FileName); "Transfer Failed" ) \]  
### See also

- [CURL.GetFailedScriptName](CURLGetFailedScriptName.md)
- [CURL.Perform](CURLPerform.md)
- [CURL.PerformAsync](CURLPerformAsync.md)
- [CURL.PerformInBackground](CURLPerformInBackground.md)
- [CURL.SetFinishedScript](CURLSetFinishedScript.md)
- [CURL.SetSucceededScript](CURLSetSucceededScript.md)

### Release notes

- **Version 14.0**
    - Added curl triggers for success and failure: [CURL.GetFailedEvaluate](https://www.mbsplugins.eu/CURLGetFailedEvaluate.shtml), [CURL.GetFailedFileName](https://www.mbsplugins.eu/CURLGetFailedFileName.shtml), [CURL.GetFailedScriptName](https://www.mbsplugins.eu/CURLGetFailedScriptName.shtml), [CURL.GetSucceededEvaluate](https://www.mbsplugins.eu/CURLGetSucceededEvaluate.shtml), [CURL.GetSucceededFileName](https://www.mbsplugins.eu/CURLGetSucceededFileName.shtml), [CURL.GetSucceededScriptName](https://www.mbsplugins.eu/CURLGetSucceededScriptName.shtml), [CURL.SetFailedEvaluate](https://www.mbsplugins.eu/CURLSetFailedEvaluate.shtml), [CURL.SetFailedScript](https://www.mbsplugins.eu/CURLSetFailedScript.shtml), [CURL.SetSucceededEvaluate](https://www.mbsplugins.eu/CURLSetSucceededEvaluate.shtml), and [CURL.SetSucceededScript](https://www.mbsplugins.eu/CURLSetSucceededScript.shtml).

### Blog Entries

- [Background Log Custom function](https://www.mbsplugins.de/archive/2024-01-09/Background_Log_Custom_function/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.6pr5](https://www.mbsplugins.de/archive/2023-12-28/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 27th December 2023 , last changed 21st June 2025

  
[CURL.SetFailedEvaluate](CURLSetFailedEvaluate.md) - [CURL.SetFinishedEvaluate](CURLSetFinishedEvaluate.md)

[HTML Version](CURLSetFailedScript.shtml)