This class is used to support all the various actions that are performed on a sales order.
allocate
global void allocate(List<ID> soIds, Boolean approve)
Allocate the specified sales orders. Sales orders are submitted for approval based on the approve parameter. This is all completed in a batch process, and the batch size is 3 sales orders.
Input Parameters
soIds |
List<ID> |
A list of sales order ids to be allocated. |
approve |
Boolean |
A Boolean that indicates whether to submit the sales orders for approval. |
Exceptions Thrown
noException |
This method does not throw an exception. If there are errors they are logged in the Error Log. It is important to check the error log regularly if this method is used. |
Return Value
Does not return a value.
allocate
global void allocate(List<ID> soIds, Boolean approve, Integer batchSize)
Allocate the specified sales orders. Sales orders are submitted for approval based on the approve parameter. This is all completed in a batch process, and the batch size is the number specified in the method call.
Input Parameters
soIds |
List<ID> |
A list of sales order ids to be allocated. |
approve |
Boolean |
A Boolean that indicates whether to submit the sales orders for approval. |
batchSize |
Integer |
The number of sales orders to include in a batch. If you make this number too large, the job will fail because the processing exceeds the Salesforce governor limits. If one salesorder in the batch fails, the entire batch is rolled back. For this reason you may want to consider a batch size of 1. |
Exceptions Thrown
noException |
This method does not throw an exception. If there are errors they are logged in the Error Log. It is important to check the error log regularly if this method is used. |
Return Value
Does not return a value.
allocateLines
global void allocateLines(Id soId, Set<Id> solIds)
Allocate the specified sales order lines. Use this method if you want to allocate the sales order synchronously.
Input Parameters
soId |
Id |
The id of the sales order being allocated. |
solIds |
Set<Id> |
A set of sales order lines being allocated. |
Exceptions Thrown
Exception |
An exception indicating problems associated with the allocation. |
Return Value
Does not return a value.
clone
global scmc__Sales_Order__c clone(ID soid)
Clone a sales order. A dynamic query is used to read all of the fields defined on the Sales Order header, including custom fields added in your org. The following fields on the header are reset to their new state.
Sales_Order_Date__c Status__c Sales_Order_Date__c Status__c Shipment_Status__c Approval_Date__c Fulfillment_Date__c Revision__c Deposit_Amount__c Deposit_Consumed__c Applied_Rebate_Amount__c Total_Customer_Rebate_Discount__c Billed_Status__c
A dynamic query is also used to read all of the fields defined on the sales order line, including the custom fields added in your org. The following fields on the sales order line are reset to their new state.
Quantity_Allocated__c Quantity_Packed__c Quantity_Shipped__c Quantity_Backordered__c Quantity_Billed__c Applied_Rebate_Amount__c Customer_Rebate_Discount__c Serial_Numbers__c Purchase_Order_Line_Item__c Original_Sales_Order_Line_Item__c
Input Parameters
soid |
ID |
The id of the sales order to clone. |
Exceptions Thrown
Exception |
An exception indicating a problem encountered while the new sales order is being created. There may be additional information in the Error Log. |
Return Value
The newly created sales order.
reverseAllocate
global void reverseAllocate(Id salesOrderId)
Reverse allocate a sales order. All lines on the sales order that are eligible to be reverse allocated are included.
Input Parameters
salesOrderId |
Id |
The Id of the sales order to be reverse allocated. |
Exceptions Thrown
Exception |
An exception is thrown if a problem occurs while the sale order is reverse allocated. |
Return Value
Does not return a value.
reverseAllocate
global void reverseAllocate(Id salesOrderId, Set<Id> salesOrderLineIdSet)
Reverse allocate specific sales order lines. All lines on the sales order that are eligible to be reverse allocated are included.
Input Parameters
salesOrderId |
Id |
The Id of the sales order to be reverse allocated. |
salesOrderLineIdSet |
Set<Id> |
A set of sales order line Ids to be reverse allocated. |
Exceptions Thrown
Exception |
An exception is thrown if a problem occurs during the reverse allocation process. |
Return Value
Does not return a value.
bill
global static Set<Id> bill(scmc__Sales_Order__c aSalesOrder, List<scmc__Sales_Order_Line_Item__c> salesOrderLineList, Decimal discountToApply)
Bill specific sales order lines.
Input Parameters
aSalesOrder |
scmc__Sales_Order__c |
The sales order containing the lines to be billed. |
salesOrderLineList |
List<scmc__Sales_Order_Line_Item__c> |
A list of sales order lines to be billed. |
discountToApply |
Decimal |
The discount value to be applied to the invoice. |
Exceptions Thrown
Exception |
An exception is thrown if a problem occurs during the billing process. |
Return Value
The IDs of the generated invoices.