• Leandro Carvalho Hotmail
  • NEWBIE
  • 0 Points
  • Member since 2015
  • SF Consulting
  • LeandroCarvalho

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 2
    Likes Given
  • 2
    Questions
  • 2
    Replies
Dear all, 

I´ve a very strange situation: the ttribute label and labelPlural in Workbench display a different Object Name than Object Edit in Setup->Create->Object.

-----------------------------------------------------------------------------------------------------------

In the Setup->Create->Object:
Singular LabelWEG_SapProfile
Plural LabelWEG_SapProfiles
Object NameWEG_SapProfile
API NameWEG_SapProfile__c
User-added image

-----------------------------------------------------------------------------------------------------------

In the Workbench:
label: SapProfile
labelPlural: SapProfiles
name: WEG_SapProfile__c

User-added image

How that´s possible??? Any ideas? If not I´ll go to delete the object (with many relationships) and recreate again... :(

Thanks in advance!
Greetings, I have developed some code for Step 5 in the Superbadge, but appear to stuck as I run the test. I am encountering an error and attempting to determine how to configure my code to pass the test. Are there any steps I am missing? I've covered much of the superbadge, but remain stuck here. 

User-added image

WarehouseCalloutServiceTest
@isTest
public class WarehouseCalloutServiceTest {
  // implement your mock callout test here
    testMethod Static void test(){
        List<EquipmentWrapperFromJSON> ListEWFS = new List<EquipmentWrapperFromJSON>();
        List<Product2> listProduct = new List<Product2>();
        Product2 p = new Product2();
        p.Replacement_Part__c = true;
        p.Name = 'testing';
        p.Cost__c = 10;
        p.Current_Inventory__c = 5;
        p.Lifespan_Months__c = 2;
        p.Maintenance_Cycle__c = 60;
        p.Warehouse_SKU__c = '10001';
        listProduct.add(p);

        insert listProduct;

        test.startTest();
            //ListEWFS = WarehouseCalloutService.wrapWquipment();
            Test.setMock(WebServiceMock.class, new WarehouseCalloutService());
            WarehouseCalloutService.runWarehouseEquipmentSync();
        test.stopTest();
        Upsert listProduct;
    }
}

MockHttpResponseGenerator
@isTest
global class MockHttpResponseGenerator implements HttpCalloutMock {
    // Implement this interface method
    global HTTPResponse respond(HTTPRequest req) {
        // Optionally, only send a mock response for a specific endpoint
        // and method.
        System.assertEquals('http:///th-superbadge-apex.herokuapp.com', req.getEndpoint());
        System.assertEquals('GET', req.getMethod());
        
        // Create a fake response
        HttpResponse res = new HttpResponse();
        res.setHeader('Content-Type', 'application/json');
        res.setBody('{"equipment":[{"id":"55d66226726b611100aaf741","replacement":false,"quantity":5,"name":"Generator 1000 kW","maintenanceperiod":365,"lifespan":120,"cost":5000,"sku":"100003"}, {"id":"55d66226726b611100aaf742","replacement":true,"quantity":183,"name":"Cooling Fan","maintenanceperiod":0,"lifespan":0,"cost":300,"sku":"100004"}]}');
        res.setStatusCode(200);
        return res;
    }
}

WarehouseCalloutService
public with sharing class WarehouseCalloutService {
    
    private static final String WAREHOUSE_URL = 'https://th-superbadge-apex.herokuapp.com/equipment';
    @future(callout=true)
    // 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();
        request.setEndpoint(WAREHOUSE_URL);
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        // If the request is successful, parse the JSON response.
        String ret = '';
        if (response.getStatusCode() == 200) {
            // Deserialize the JSON string into collections of primitive data types.
            List<Object> results = (List<Object>) JSON.deserializeUntyped(response.getBody());
            
            List<Product2> LstProduct = new List<Product2>();
            for(Object obj : results)
            { 
                Map<String, Object> mapobj = (Map<String, Object>)obj;
                Product2 product = new Product2();
                           
                Integer maintenanceperiod = (Integer)mapobj.get('maintenanceperiod');               
                Integer Lifespan = (Integer)mapobj.get('lifespan');
                Integer Cost = (Integer)mapobj.get('cost');
                Boolean replacement = (Boolean)mapobj.get('replacement');
                Integer quantity = ((Integer)mapobj.get('qIntegerntity'));
                product.Name  = (String)mapobj.get('name'); 
                product.Maintenance_Cycle__c = Integer.valueof(maintenanceperiod);
                product.Cost__c = Cost;
                product.Current_Inventory__c = quantity;
                product.Lifespan_Months__c = Lifespan; 
                product.Replacement_Part__c = replacement;
                product.Warehouse_SKU__c = (String) mapobj.get('sku');
                product.ProductCode = (String)mapobj.get('_id');       
                LstProduct.add(product);
            }
            System.debug(LstProduct);
            upsert LstProduct Warehouse_SKU__c;
        }
        
    }
}

 
Dear all, 

I´ve a very strange situation: the ttribute label and labelPlural in Workbench display a different Object Name than Object Edit in Setup->Create->Object.

-----------------------------------------------------------------------------------------------------------

In the Setup->Create->Object:
Singular LabelWEG_SapProfile
Plural LabelWEG_SapProfiles
Object NameWEG_SapProfile
API NameWEG_SapProfile__c
User-added image

-----------------------------------------------------------------------------------------------------------

In the Workbench:
label: SapProfile
labelPlural: SapProfiles
name: WEG_SapProfile__c

User-added image

How that´s possible??? Any ideas? If not I´ll go to delete the object (with many relationships) and recreate again... :(

Thanks in advance!
Has anyone ever had an issue where you are unable to check that the challenge is complete? I am trying to finish up the Admin Beginners module and on the Create and customize List Views module, I have no option to check that the challenge is completed. 
I'm not getting credit for the challenge I did for the "Create and Customize List Views" module.  The challenge is gone and clicking on it on the right doesn't let me do it again.  I've completed this module and I'd like for it close out.  Need some help so I can close out the module and Admin Beginner Trail!