Knowledge Center

Knowledge Center > Commerce > Zuora for Salesforce Development Resources > Order Builder > Order Builder Reference > zgenerate Method

zgenerate Method

This article describes the Order Builder zgenerate() method. The zgenerate() method uses the Zuora generate() method to generate invoice(s) for one or more specified customer accounts on demand.

The zgenerate() method is available in Zuora 360 version 2.60 or higher.

Syntax

List<zApi.SaveResult> zgenerate(List<zObject> invoiceList)

Input Parameters

The zgenerate() method takes the following input parameters.

Parameter Type Description

invoiceList

List<zObject> 

A list of one or more Invoice objects, up to a maximum of 50. Only the following three fields are required, but other appropriate fields may be specified.

  • AccountId - A valid Zuora account ID
  • InvoiceDate - An invoice date formatted per Zuora Date format, for example, "2013-04-03T08:07:55-08:00"
  • TargetDate - A target date formatted per Zuora Date format, for example, "2013-04-03T08:07:55-08:00"
 

Response

The zgenerate() method returns a list of the zApi.SaveResult objects that provides the result of the generate() call.

zApi.SaveResult

The zApi.SaveResult has the following properties.

Property Description
Errors

If the create or update failed, this contains an array of Error objects of this form:

  • Code - The ErrorCode for the error that occurred
  • Field - If the error is a field error, this string indicates which field failed.
  • Message -  A string that describes the error
 
Id If successful, the ID of the created object
Success If the create or update was successful, true. Otherwise false.

Exceptions

The zgenerate() method uses the following exception classes to catch the exception when an error occurs:

  • zAPIException
  • zForceException
  • zRemoteException

Sample Code

zApi api = new zApi();
api.zlogin();

List<zObject> invoiceList = new List<zObject>();

zObject invoice = new zObject('Invoice');
invoice.setValue('AccountId', XXX);
invoice.setValue('InvoiceDate', '2013-04-03T08:07:55-08:00');
invoice.setValue('TargetDate', '2013-04-03T08:07:55-08:00');
invoiceList.add(invoice);

List<zApi.SaveResult> generateResult = api.zgenerate(invoiceList);
Last modified
16:58, 2 Jun 2016

Tags

Classifications

(not set)