Unbundle

Unbundle a bundle of service appointments. This resource accepts a bundle ID. This API is not supported in Gov Cloud. This endpoint is available in version 54.0 and later of the Salesforce API.

Add a Remote Site 

  1. From Setup, in the Quick Find box, enter Security, and then select Remote Site Settings.

  2. Click New Remote Site.

  3. Enter a name.

  4. For Remote Site URL, enter https://api.salesforce.com/

  5. Save your changes.

Syntax 

URI: HOST/bundleflow/api/v1.0/bundle/<ID>?initiate=manual

Where HOST is a variable.

Format: JSON

HTTP Method: DELETE

Authentication: Authorization: Bearer TOKEN

Where TOKEN is a variable.

If the authentication token isn’t valid, a 401 HTTP status is returned.

Headers:

  • request.setHeader('x-sfdc-tenant-id', 'core/prod/ORG-ID_18_Characters');—Field Service functional domain
  • sf_api_version—Salesforce API version. Minimum version is 53.0.
  • Authorization—Authorization token.
  • Content-Type—File format. Valid value is JSON.
  • Referer—Org domain URL.

Parameters:

ParameterDescription
IDUnique ID of the bundle.

Response Body 

The response body contains these properties.

FieldTypeDescription
bundleIdStringID of the bundle. If the unbundling fails, it’s null.
responsePayloadsArrayResponse details of unbundling the service appointments. If it’s successful, the payload is null. If the unbundling fails, the payload shows error details.
statusStringStatus of unbundling the service appointments. Output: FAIL.
messageCodeNumberError code. The error codes are listed in Error Responses.
messageStringError message.
statusStringStatus of the request. Output: SUCCESS or FAIL.
messageCodeNumberSuccess or error code of the request. 0 means success. The error codes are listed in Error Responses.
messageStringSuccess or error message of the request.
messageAdditionalInfoStringMore information provided by Salesforce.

Example: Successful Response 

This example shows the output of service appointments that are unbundled successfully.

1{
2   "bundleId":"08px000000NzdMXAAZ",
3   "responsePayloads":null,
4   "status":"SUCCESS",
5   "messageCode":"NONE",
6   "message":"Success"
7}

Example: Fail Response 

This example shows the output of a request where the user entered a service appointment ID instead of a bundle ID. The request only works with bundle IDs, so the response status is FAIL.

1{
2   "bundleId":null,
3   "responsePayloads":[
4      {
5         "status":"FAIL",
6         "messageCode":"GET_BUNDLE_INFO_FAILURE",
7         "message":"Replace the service appointment with a bundle service appointment.",
8         "messageParams":[
9            
10         ]
11      }
12   ],
13   "status":"FAIL",
14   "messageCode":"ERROR_UNBUNDLING",
15   "message":"We couldn’t unbundle the service appointment.",
16   "messageAdditionalInfo": ""
17}

Error Responses 

CodeNameMessage
0NONE<Service Appointment ID#>: Success.
1UNSUPPORTED_VERSIONAsk your admin to check the API version, then try again.
2SA_PAYLOAD_SHOULD_CONTAIN_ADD_ACTIONS_ONLYCreate bundles using add actions only.
3EMPTY_BUNDLE_POLICYEnter an ID for the bundlePolicyId.
4EMPTY_BUNDLE_INITIATESpecify manual or auto for the initiate entry.
5EMPTY_BUNDLE_SERVICE_APPOINTMENTAdd a bundle service appointment.
6SA_PAYLOAD_DUPLICATED_SASRemove duplicate service appointment IDs.
7SA_IS_BUNDLE<Service Appointment ID#>: Is already a bundle service appointment.
8SA_ALREADY_BUNDLED<Service Appointment ID#>: Is a bundle member service appointment in another bundle.
9STATUS_FORBIDDEN<Service Appointment ID#>: Can’t be bundled in the current status.
10SA_PAYLOAD_SHOULD_NOT_CONTAIN_MIX_ACTIONSSend separate requests for add and remove actions.
11SA_IS_NOT_BUNDLESelect a bundle service appointment and try again.
12EXCEEDED_BUNDLE_MEMBERS_LIMITYou reached the maximum number of service appointments for this bundle. Remove some of them and try again.
13SA_PAYLOAD_SHOULD_CONTAIN_ONLY_BUNDLE_MEMBERSTo remove bundle members from a bundle, include only service appointments that are bundle members.
14ERROR_IN_BASIC_VALIDATIONSWe couldn’t bundle the service appointments.
15ERROR_IN_LIMIT_VALIDATIONSN/A
16ERROR_IN_CRITERIA_VALIDATIONSN/A
17ERROR_IN_SERVICE_TERRITORY_VALIDATIONSConfirm or revise the service territories of the selected service appointments. Or ask your admin for help.
18ERROR_IN_RESTRICTION_VALIDATIONSConfirm or revise the selected service appointments. Or ask your admin to check the restriction policies.
19EXCEEDED_BUNDLE_DURATION_LIMITN/A
20EMPTY_BODYFill in the request.
21SA_IS_NOT_BUNDLED<Service Appointment ID#>: Can’t remove a service appointment that isn’t in the bundle.
22ERROR_IN_AGGREGATIONConfirm or revise the selected service appointments. Or ask your admin to check the aggregation policies.
23ERROR_IN_PROPAGATIONConfirm or revise the selected service appointments. Or ask your admin to check the propagation policies.
24GET_POLICY_FAILUREAsk your admin to check the bundle policies, then try again.
25GET_CONFIG_FAILUREAsk your admin to check the bundle config, then try again.
26GET_BUNDLE_INFO_FAILURETry again later.
27ERROR_IN_LOGICWe couldn’t bundle the service appointments.
28EMPTY_BUNDLE_MEMBERSAdd bundle member service appointments.
29EMPTY_BUNDLE_PARENT_WORK_ORDER_IDAdd the work order ID for the bundle service appointment.
30UNBUNDLE_REQUEST_ASSIGNED_RESOURCES_NOT_COMPATiBLETo unbundle a scheduled bundle, send assigned resources for each service appointment.
31EMPTY_OLD_VALUESTo update a bundle, send the current values.
32EMPTY_NEW_VALUESTo update a bundle, send the new values.
33SA_PAYLOAD_SHOULD_CONTAIN_AT_LEAST_ONE_ADD_OR_REMOVE_ACTIONTo update a bundle, send at least one add or remove action.
34FORBIDDEN_FIELDS_IN_POLICY_OBJECTConfirm or revise the selected service appointments. Or ask your admin to check the field names selected in the related policies.
35EMPTY_SERVICE_TERRITORYAdd a Service Territory ID.
36EMPTY_START_TIMEAdd the interval’s start time.
37EMPTY_END_TIMEAdd the interval’s end time.
38ERROR_IN_BUNDLE_POLICY_RFCConfirm or revise the selected service appointments. Or ask your admin to check the recordset filter criteria in the bundle policy.
39ERROR_IN_TIME_ZONE_VALIDATIONSelect service appointments that are in the same time zone. Or ask your admin for help.
40ERROR_IN_LOGIC_UNBUNDLEWe couldn’t unbundle the service appointment.
41ERROR_CREATING_BUNDLEWe couldn’t bundle the service appointments.
42ERROR_ADDING_TO_BUNDLEWe couldn’t add the service appointment to the bundle.
43ERROR_REMOVING_FROM_BUNDLEWe couldn’t remove the service appointment from the bundle.
44ERROR_UNBUNDLINGWe couldn’t unbundle the service appointment.
58ERROR_IN_MSW_VALIDATIONSWe can’t bundle service appointments with dependencies. Remove the dependencies and try again.
-500http errorHmm… Something went wrong. Try again.