• 105 Points
  • Member since 2018
  • Salesforce Developer
  • Capitalone

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 3
i have a Detail Page button on OLI that calls this flow.  In Lightning I get a " refused to Connect " error and hangs on the Screen.  Does any one know how to fix this so it will work in Lightning?

I have a custom object - program and i have a picklist field - status in it. We also have record types for this object. We have created path for different record types and we have deployed. But when i try pushing other changes for program object (Eg. Validation rules on program, list views for program object etc), we are getting the below error
User-added image

Request to guide on fixing the issue. 

Thanks in advance!


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!