ccrz.ccLogicOrderSplitOrder.copyOrder

Copies the original order data to a new ccrz__E_Order__c record.

Compatibility

This reference applies to:

Release Managed Package Version API Version
B2B Commerce for Visualforce Winter ’21 4.13 12
B2B Commerce for Visualforce Spring ’20 4.12 11
B2B Commerce for Visualforce Summer ’19 4.11 10
B2B Commerce for Visualforce Spring ’19 4.10 9
B2B Commerce for Visualforce Summer ’18 4.9 8

Signature

global virtual Map<String, Object> copyOrder(Map<String, Object>)

Inputs (Required)

This method accepts the working Map<String, Object> from the ccrz.ccLogicOrderSplitOrder.createNewOrders method.

This method requires the following keys in the working map:

ccrz.ccApiOrder.ADDRIDMAP
Map<String, Object>, where:
ccrz.ccApiOrder.OLDADDRDATA
List<Map<String, Object>>, where each Map<String, Object> describes a ccrz__E_ContactAddr__c record that the original order referenced for a billing or shipping address.
  • This method copies these addresses, and the ccrz.ccLogicOrderSplitOrder.insertNewOrders method assigns the copies to the new order records.
  • If you override this method in an extension and add other address data, be sure to set each address' ownerId to the same value as ccrz.ccApiOrder.PARAM_OWNERID.

Note

ccrz.ccApiOrder.PARAM_OWNERID
String that specifies the owner for the new order.
ccrz.ccApiOrder.SPLITID
String that specifies the criteria to split the original order by, such as seller ID.
ccrz.ccApiOrder.SRCORD
ccrz__E_Order__c, which specifies the original order record to copy.

Logic Performed

The ccrz.ccLogicOrderSplitOrder.createNewOrders method calls into this method for creating each new order. This method completes the following actions for each new order:

  1. Calls the sObject clone method to create a duplicate of the original ccrz__E_Order__c.
  2. Sets the following field values on the new order:
    Field Value
    ccrz__AdjustmentReason__c null
    ccrz__EncryptedId__c null
    ccrz__OrderNumber__c null
    ccrz__OrderSeller__c The seller ID.
    ccrz__SplitParentOrder__c The ID of ccrz.ccApiOrder.SRCORD
    ccrz__SplitProcessed__c TRUE

    When this field is FALSE, the order remains eligible for future ccrz.ccSplitOrderJob batch processing.

    Note

  3. Calls the ccrz.ccLogicOrderSplitOrder.setOrderOwner method for setting the new order's owner to ccrz.ccApiOrder.PARAM_OWNERID.
  4. Creates copies of the address data, which the ccrz.ccLogicOrderSplitOrder.insertNewOrders method assigns to the new orders.
  5. Sets initial values of 0.00 for the new order's amounts and charges.

Outputs

This method returns the working Map<String, Object>, and sets the following key:

ccrz.ccApiOrder.NEWORD
ccrz__E_Order__c for the new order, ready to insert.