Challenge Not yet complete... here's what's wrong: The WarehouseCalloutService class does not appear to have run successfully as the equipment records are not found in the database. The REST endpoint returns 22 records so your org should have at least 22 records in the Product2 table. Make sure that you successfully run this class at least once before attempting this challenge. Since this class is implementing the queueable interface, you may want to wait to ensure that it has processed successfully.
Remote Site Name - WarehouseURL Remote Site URL - th-superbadge-apex.herokuapp.com ********************* WarehouseCalloutService class *********************** public with sharing class WarehouseCalloutService implements Queueable { private static final String WAREHOUSE_URL = 'th-superbadge-apex.herokuapp.com/equipment';
//class that makes a REST callout to an external warehouse system to get a list of equipment that needs to be updated. //The callout’s JSON response returns the equipment records that you upsert in Salesforce.
@future(callout=true) public static void runWarehouseEquipmentSync(){ Http http = new Http(); HttpRequest request = new HttpRequest();
Challenge Not yet complete... here's what's wrong:
The WarehouseCalloutService class does not appear to have run successfully as the equipment records are not found in the database. The REST endpoint returns 22 records so your org should have at least 22 records in the Product2 table. Make sure that you successfully run this class at least once before attempting this challenge. Since this class is implementing the queueable interface, you may want to wait to ensure that it has processed successfully.
Same
How did you resolve this error
❤
Bro I am getting like this -- "Class WarehouseCalloutService must implement the Queueable interface."
I AM ALSO GETTING THE SAME ERROR WHAT TO DO
PLEASE REPLY
first save all and try again@@Anu1901
Since you’re using a Queueable job, the @future annotation is not needed. The Queueable job itself handles asynchronous processing. - Remove @future
Remote Site Name - WarehouseURL
Remote Site URL - th-superbadge-apex.herokuapp.com
********************* WarehouseCalloutService class ***********************
public with sharing class WarehouseCalloutService implements Queueable {
private static final String WAREHOUSE_URL = 'th-superbadge-apex.herokuapp.com/equipment';
//class that makes a REST callout to an external warehouse system to get a list of equipment that needs to be updated.
//The callout’s JSON response returns the equipment records that you upsert in Salesforce.
@future(callout=true)
public static void runWarehouseEquipmentSync(){
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint(WAREHOUSE_URL);
request.setMethod('GET');
HttpResponse response = http.send(request);
List warehouseEq = new List();
if (response.getStatusCode() == 200){
List jsonResponse = (List)JSON.deserializeUntyped(response.getBody());
System.debug(response.getBody());
//class maps the following fields: replacement part (always true), cost, current inventory, lifespan, maintenance cycle, and warehouse SKU
//warehouse SKU will be external ID for identifying which equipment records to update within Salesforce
for (Object eq : jsonResponse){
Map mapJson = (Map)eq;
Product2 myEq = new Product2();
myEq.Replacement_Part__c = (Boolean) mapJson.get('replacement');
myEq.Name = (String) mapJson.get('name');
myEq.Maintenance_Cycle__c = (Integer) mapJson.get('maintenanceperiod');
myEq.Lifespan_Months__c = (Integer) mapJson.get('lifespan');
myEq.Cost__c = (Integer) mapJson.get('cost');
myEq.Warehouse_SKU__c = (String) mapJson.get('sku');
myEq.Current_Inventory__c = (Double) mapJson.get('quantity');
myEq.ProductCode = (String) mapJson.get('_id');
warehouseEq.add(myEq);
}
if (warehouseEq.size() > 0){
upsert warehouseEq;
System.debug('Your equipment was synced with the warehouse one');
}
}
}
public static void execute (QueueableContext context){
runWarehouseEquipmentSync();
}
}
******************************** Code Runned Under Anonymous Window ****************************
System.enqueue Job (new warehousecallout Service());
you should pin this on the top
Corrected Code Runned Under Anonymous Window : System.enqueueJob(new warehousecalloutService());
bro spacing ka error aa rha h, video me execution code of comment me alag h
****************************** Code Runned Under Anonymous Window **************************
System.enqueueJob(new warehousecalloutService());
😊
bro please provide code