0

Cloud Craze, aka Salesforce B2B Commerce. Joy and sorrow of the e-commerce world, but mostly sorrow.

I am trying to modify the structure of the CCRZ object in Cloud Craze, and I need to understand which process is in charge of building it.

I would like to bring the field “Order Name” to be included within the CCRZ object, so that I can refer to it with Handlebars.

At the moment, the fields I have available for the single order in the client are:

  1. canAmend: false
  2. canCancel: false
  3. canReOrder: true
  4. cartId: "a500i0OEAQ"
  5. currencyIsoCode: "EUR"
  6. encryptedId: "96d-7fa3-4939-b0aa-41292"
  7. extrinsic: {OrderReference: "917100"}
  8. name: "O-0000001719"
  9. orderDate: 1573516800000
  10. orderDateStr: "11/12/2019"
  11. orderUtil: {orderComplete: false, showDiscounts: false}
  12. ownerName: "Alessio"
  13. paymentMethod: "Prepayment"
  14. requestDate: "12/9/2019"
  15. requestDateVal: 1575849600000
  16. sfid: "a5y1l0000000KrDAAU"
  17. shippingMethod: "CIP by Ship to Dublin"
  18. status: "Order Submitted"
  19. subTotalAmount: 750
  20. totalAmount: 1373.9
  21. proto:

I need to include another custom field which is called Order Name (different from the name field you see in position 8 above). Field API name is ccrz__Name__c.

How can I make it surface in the CCRZ object? I tried to modify a class which extends ccrz.ccServiceOrder, by adding the extra field. However, this simple change breaks the checkout process downstream.

I tried to work on a class which extends ccrz.cc_hk_Order, by trying to include the orderName in the extrinsic Map, but to no avail either.

I verified that the Cloud Craze Customer User has read access to that field.

Can anybody out there help me with this or give me a hint?

I will send you a personalized thank you card :) Thanks in advance for your help.

1 Answer 1

2

Hi Alessio hope you already received an answer for this but if not you are headed down the correct path.

In order to get custom order fields in the CCRZ object you need to extend the ccrz.ccServiceOrder class and override the getFieldsMap method. Here is the pattern to follow for extending DataService classes.

global virtual override Map<String, Object> getFieldsMap(Map<String, Object> inputData) 
{
    inputData = super.getFieldsMap(inputData); 

    String objectFields = (String)inputData.get(ccrz.ccService.OBJECTFIELDS); 
    //objectFields += ', MyCustomField__c' ; 

    return new Map <String,Object> {ccrz.ccService.OBJECTFIELDS => objectFields}; 
}

If you have already done that, and are still getting an error, can you provide more info on the error?

1
  • Hi my friend, thanks so much, that is the approach we followed in the end. Overriding ccServiceOrder ftw :) Commented Dec 18, 2019 at 17:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .