zdelete Method

Knowledge Center > Zuora CPQ > Zuora CPQ Development Resources > Order Builder > Order Builder Reference > zdelete Method

zdelete Method


This article describes the Order Builder zdelete() method. The zdelete() method uses the Zuora delete() method to delete Zuora objects or records.


List<zApi.DeleteResult> zdelete(String ztype, String[] ids)

Input Parameters

The zdelete() method takes the following input parameters.

Parameter Type Description
ztype String Indicates the type of object to be deleted
ids String[] A list of the records to be deleted


The zdelete() method returns a list of zApi.DeleteResult that provides the results of the Zuora delete() call.


The DeleteResult has the following properties.

Properties Type Description
errors List If the delete failed, this contains an array of Error objects.
id String ID of the deleted object
success Boolean A boolean field indicating the success of the delete operation. If the delete was successful, it is true. Otherwise, false.


The zdelete() method uses the following exception classes to catch the exception when an error occurs during the delete.

  • zAPIException
  • zForceException
  • zRemoteException

Sample Code

// zApiInstance should be instantiated and the login() method must
// have been invoked prior to invoking any other method on the
// object

try {
List<String> ids = new List<String>();

List<Zuora.zApi.DeleteResult> results =

for (Zuora.zApi.DeleteResult result : results) {
if (result.Success){
//get the deleted object id
String deletedId = result.Id;
//more code here...
} else {
//get the errors
Zuora.zObject[] errors = result.errors;
for (Zuora.zObject error : errors) {
String errorCode = (String)error.getValue('Code');
String message = (String)error.getValue('Message');
//more code here...
} catch (Zuora.zRemoteException ex) {
if ('INVALID_FIELD' == ex.code) {
// An invalid field was specified
//more code here...
} else {
//more code here...
} catch (Zuora.zAPIException ex) {
//more code here...
} catch (Zuora.zForceException ex) {
//more code here...
Last modified



(not set)