• Charles clark 17
  • 0 Points
  • Member since 2022

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 4
Need Ideas for my college project on Restaurant Point of Sale..I mean my intention is to use salesforce lightning,Apex programming to achieve below features in my dev org.

Can anyone suggest me what should be my approach to achieve below functionalities namely A),B) and C) below,if you can go detailed steps,would be really grateful.Want to keep this thread a living document for others who wish to develop such project in future.

A) Inventory management:
-->Here i want to manage ingredient level inventory in real-time and start restocking at the right levels

B) Online Ordering:
-->Here i want customer can send order tickets straight to the kitchen

C) Table Management:
-->Here i want on-table ordering that allows restaurant customers to order food from android phone
-->Give feedback right from the table without having to wait for restaurant staff


In point 2, i cant check it as sucess because it show the following error:

Challenge Not yet complete... here's what's wrong: 
The runWarehouseEquipmentSync method does not appear to have run successfully. Could not find a successfully completed @future job for this method. Make sure that you run this method at least one before attempting this challenge. Since this method is annotated with the @future method, you may want to wait for a few seconds to ensure that it has processed successfully.
This is my code:

Warehouse Callout Service
public with sharing class WarehouseCalloutService {
    private static final String WAREHOUSE_URL = 'https://th-superbadge-apex.herokuapp.com/equipment';
    // complete this method to make the callout (using @future) to the
    // REST endpoint and update equipment on hand.
    public static void runWarehouseEquipmentSync(){
        Http http = new Http();
		HttpRequest request = new HttpRequest();
		HttpResponse response = http.send(request);
		// If the request is successful, parse the JSON response.
		if (response.getStatusCode() == 200) {
    		// Deserialize the JSON string into collections of primitive data types.
    		List<Object> equipments = (List<Object>) JSON.deserializeUntyped(response.getBody());
            List<Product2> products = new List<Product2>();
            for(Object o :  equipments){
                Map<String, Object> mapProduct = (Map<String, Object>)o;
                Product2 product = new Product2();
                product.Name = (String)mapProduct.get('name');
                product.Cost__c = (Integer)mapProduct.get('cost');
                product.Current_Inventory__c = (Integer)mapProduct.get('quantity');
                product.Maintenance_Cycle__c = (Integer)mapProduct.get('maintenanceperiod');
                product.Replacement_Part__c = (Boolean)mapProduct.get('replacement');
                product.Lifespan_Months__c = (Integer)mapProduct.get('lifespan');
                product.Warehouse_SKU__c = (String)mapProduct.get('sku');
                product.ProductCode = (String)mapProduct.get('_id');
            if(products.size() > 0){
                upsert products;

Warehouse Callout Service Mock
global class WarehouseCalloutServiceMock implements HttpCalloutMock {
    // implement http mock callout
    global HttpResponse respond(HttpRequest request){
        System.assertEquals('https://th-superbadge-apex.herokuapp.com/equipment', request.getEndpoint());
        System.assertEquals('GET', request.getMethod());
    	// Create a fake response
		HttpResponse response = new HttpResponse();
        response.setHeader('Content-Type', 'application/json');
		response.setBody('[{"_id":"55d66226726b611100aaf741","replacement":false,"quantity":5,"name":"Generator 1000 kW","maintenanceperiod":365,"lifespan":120,"cost":5000,"sku":"100003"}]');
        return response;
Warehouse Callout Service Test
private class WarehouseCalloutServiceTest {
  // implement your mock callout test here
    static void WarehouseEquipmentSync(){
        // Set mock callout class 
        Test.setMock(HttpCalloutMock.class, new WarehouseCalloutServiceMock()); 
        // This causes a fake response to be sent from the class that implements HttpCalloutMock. 
        System.assertEquals(1, [SELECT count() FROM Product2]);        
In another hand, I created an Remote Site Detail to bring access to JSON external list "Equipment". The debugs are made by "Execute Anonymous Window" option and Run "Warehouse Callout Service Test" class. Finally, I change to visible all Product's fields for all profiles.

Can anyone help me?

Thanks & Regards!

I need to create a formula that locks opportunities once they reach a certain stage. We want only a the administrator to be able to make changes once the opportunity hits the stage so we can make sure the date and the amounts don't change. Can someone help explain how I would go about creating the formula or if this is even possible?



I am trying to encrypt and decrypt a password using the Crypto class.



     Blob cryptoKey = Crypto.generateAesKey(128);
    	 Blob data = Blob.valueOf(weUserRec.password__c);
      Blob encryptedData = Crypto.encryptWithManagedIV('AES128', cryptoKey, data);
      Blob decrypt = Crypto.decryptWithManagedIV('AES128', cryptoKey, data);
  }catch(Exception e){


The above is throwing an exception with message "Invalid initialization vector. Must be 16 bytes" (InvalidParameterValue).

Since the SF provided Managed IV methods are used here (the code is almost exactly like the sample), why does it throw this error?


  • November 24, 2010
  • Like
  • 0