• Neel Shah 12
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hello All,
I have written the following code but it still gives me error. 
May i know the mistake i am doing and how can i rectify ?
Error: 
The outputLink component on the 'NewCaseList' page isn't binding to the ID of a case.

Code: 
VF Code: 
 
<apex:page controller="NewCaseListController">
  <apex:pageBlock title="New Case List" id="case_list" >
      <apex:pageBlockTable value="{!NewCases}" var="ct">
          
         <apex:column headervalue="Case Link"><apex:outputLink value="/{!ct.id}">{!ct.id}</apex:outputLink>
       </apex:column>
          <apex:column value="{!ct.CaseNumber}">  
          
          </apex:column>
          <apex:column value="{!ct.Status}"/> 
         
  <apex:repeat var="case" value="{!NewCases}">
    </apex:repeat>
          
          </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>


Controller:
public class NewCaseListController {
    List<Case> results = new List<case>(); 
    public List<Case> getNewCases()

     {
        results =[SELECT ID, CaseNumber, status FROM Case where status='New' LIMIT 10 ];

       return results;

    }
}


Output :
User-added image

Thanks in advance. 
Hello all, i would like to know some real-world scenarios or dummy project ideas where i can build my portfolio. I have created a developer org to create below functionalities. Any help regarding the project ideas will be appreciated to create this functionalities in an org. e.g what type of workflow, tasks to be created in the projects. 
  1. Create a Welcome Message on the home page and/or sidebar. For each of the Objects: Account, Contact, Opportunity:
  • Create two new fields: of the 6 fields (in total) you create one must be a lookup relationship, one must be a picklist with multiple values, and one must be a text field
  • Set up your Page Layouts in an intuitive manner.

2. Create a validation rule on one or more of your custom text fields to ensure the value entered meets certain criteria
3. Create a workflow to update a field, based on information entered into another field.
4. Create ten (10) opportunities (lost, won, or open), three (3) account and three (3) contact record using your browser or API
5. Create two tasks under any contact, one (1) open and one (1) complete task. (To understand the difference between those task)
6. Create a Report of Opportunities which shows EXPECTED revenue by stage with a Funnel Chart.

Greetings,

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.
    @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);
		// 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');
                products.add(product);
            }
            if(products.size() > 0){
                System.debug(products);
                upsert products;
            }
		}
    }
 
}

Warehouse Callout Service Mock
@isTest
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"}]');
        response.setStatusCode(200);
        return response;
    }
}
Warehouse Callout Service Test
@isTest
private class WarehouseCalloutServiceTest {
  // implement your mock callout test here
	@isTest
    static void WarehouseEquipmentSync(){
        Test.startTest();
        // Set mock callout class 
        Test.setMock(HttpCalloutMock.class, new WarehouseCalloutServiceMock()); 
        // This causes a fake response to be sent from the class that implements HttpCalloutMock. 
        WarehouseCalloutService.runWarehouseEquipmentSync();
        Test.stopTest();        
        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'm getting the error "The outputLink component is not binding to the ID of a case" for this challenge. I've checked several threads on here and I'm almost certain it should be correct. It does link to the details page for the case. 

I initially just had the ID linking but have changed it so both case number and id link via id in case that mattered. 

I've also previously tried having a complete url as the value but no luck. 

Any help would be appreciated.

<apex:page controller="NewCaseListController">
 
        <apex:pageBlock title="New Case List" id="cases_list">
            
    <apex:repeat value="{! newcases }" var="cases">
       
        <apex:outputLink value="/{! cases.id}">
        ID:  {! cases.id }
        </apex:outputLink><br/>
        <apex:outputLink value="/{! cases.id}">
        Case Number:  {! cases.CaseNumber }
        </apex:outputLink><br/>    
    
    </apex:repeat>
            
        </apex:pageBlock>