• Rajeevan S
  • 0 Points
  • Member since 2016

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 3
Here is the Code used:

Http http = new Http();
HttpRequest requests = new HttpRequest();
HttpResponse response = http.send(requests);
List<Product2> prodList = new List<Product2>();        
if(response.getStatusCode() == 200){
           Product2 prod = new Product2();
           List<Object> equipments =(List<Object>) JSON.deserializeUntyped(response.getBody()) ;
         Set<String> skuSet=new Set<String>();    
        for(Object o: equipments){            
            Map<String,Object> prodMap = (Map<String,Object>)o; 
            prod.Name = (String)prodMap.get('name');
               prod.Replacement_Part__c = true;
               prod.Cost__c = (Integer) prodMap.get('cost');
               prod.Current_Inventory__c = (double)prodMap.get('quality');
               prod.Lifespan_Months__c = (Integer)prodMap.get('lifespan');
               prod.Maintenance_Cycle__c = (double) prodMap.get('maintenanceperiod');
               prod.Warehouse_SKU__c = (String) prodMap.get('sku');
upsert prodList Warehouse_SKU__c;

This is the Error im getting:

System.ListException: Before Insert or Upsert list must not have two identically equal elements.

Here is the JSON format link: https://th-superbadge-apex.herokuapp.com/equipment

Please help me to go forward with the challenge.
I want to display the sample of the data present in visualforce component when the button is clicked.the button is created on a lightning component.any suggestions.
I want to write a trigger on below:
Create an account record whenever contact is created without an account.

Thanks in advance..!!
  • August 25, 2021
  • Like
  • 1
Hi all,

How can I get other fields' value of recordId attribute in Lightning component?
For instance, recordId of Opportunity, want to get AccountId of this opportunity