scmc.InvoicingsServiceglobal with sharing class InvoicingsService This service is used to support actions that are performed on an invoice. Methods
isInvoiceToBillingDocumentExportJobScheduledglobal static Boolean isInvoiceToBillingDocumentExportJobScheduled() Checks if the job that exports invoices as billing documents to Foundations is scheduled. Return ValueReturns true if the job is already scheduled. Otherwise, returns false. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. Boolean result = SCMC.InvoicingsService.isInvoiceToBillingDocumentExportJobScheduled(); if(result) { // do something in case job scheduled } else { // do something in case job is not scheduled } scheduleInvoiceToBillingDocumentExportglobal static String scheduleInvoiceToBillingDocumentExport(scmc.InvoicingsService.SchedulerConfiguration schedulerConfig) Schedules a job to export invoices as billing documents automatically. The method only schedules the job if it is not already scheduled. Input Parameters
Exceptions Thrown
Return ValueThe scheduled job ID. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. //This code will schedule the job to run 5 times from today @12:00 AM SCMC.InvoicingsService.SchedulerConfiguration schedulerConfig = new SCMC.InvoicingsService.SchedulerConfiguration(); schedulerConfig.cronExpression = '0 0 0 * * ?'; schedulerConfig.startDate = System.today(); schedulerConfig.numberOfOccurrences = 5; String scheduledJobId = SCMC.InvoicingsService.scheduleInvoiceToBillingDocumentExport(schedulerConfig); invoiceToBillingDocumentExportglobal static Set<Id> invoiceToBillingDocumentExport(Set<Id> invoiceIdSet) Creates a billing document from a given invoice. To create a billing document from an invoice, the invoice must have a status of Closed, an export status of New, display no export errors in the Export Error field, and have a credit status other than Fully Credited. If it has a shipment, the shipment status must be Shipment Complete. Input Parameters
Exceptions Thrown
Return ValueThe IDs of the invoices from which billing documents have been successfully created. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. Set<Id> invoiceIds = new Set<Id>{'a069E0000004NBO'}; Set<Id> successInvoiceIdSet = SCMC.InvoicingsService.invoiceToBillingDocumentExport(invoiceIds); scmc.InvoicingsService.SchedulerConfigurationglobal inherited sharing class SchedulerConfiguration Provides the configuration information to create a scheduled job. Properties
|