• Sandhyarani S P
  • NEWBIE
  • 25 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 5
    Replies
Hi all! I need to write test class for wrapper class coverage. There is my controller:
public class StoreFrontController {
List<DisplayMerchandise> products;
public List<DisplayMerchandise> getProducts() {
if(products == null) {
products = new List<DisplayMerchandise>();
for(Merchandise__c item : [
SELECT Id, Name, Description__c, Price__c, Total_Inventory__c
FROM Merchandise__c]) {
products.add(new DisplayMerchandise(item));
}
}
return products;
}
// Inner class to hold online store details for item
public class DisplayMerchandise {

private Merchandise__c merchandise;
public DisplayMerchandise(Merchandise__c item) {
this.merchandise = item;
}
// Properties for use in the Visualforce view
public String name {
get { return merchandise.Name; }
}
public String description {
get { return merchandise.Description__c; }
}
public Decimal price {
get { return merchandise.Price__c; }
}
public Boolean inStock {
get { return (0 < merchandise.Total_Inventory__c); }
}
public Integer qtyToBuy { get; set; }
}
}
What Unit Test can I do for my inner class ?

Thanx
 
Hi, 
My requirement is to show a link to an attachment in edit and create page.
I have created formula hyperlink field it displays only in detail page, I want the link to be displayed in create and edit page.
I know formula fields does not support in edit and create page, is there any way to add a link in these pages.
I don't want override edit and create pages through VF page, I want to achieve in standard pages only.

Regards,
Sandhya S P
Hi,

I have created a process to capture user's timezone to a custom text field, but I am getting an error when trying to create or edit a record.
Help me to resolve this error or let me know is there any other solutions to capture users time zone when user create or edit a record.
Below is the error I am getting 
The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID xxxxxxxxxxx. Flow error messages: An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.

Regards,
Sandhya S P
User-added image

I am getting this error while saving through visualforce page and i am not able to login to saleforce support, after giving my credentials again it will redirect to homepage.
 
Hi all,

How to validate the csv file, if no data in rows and columns.
Please rly me.
 
Hi all,

Can anyone please tell me how can i cover this code.

public List <SelectOption> EmailList
    {
        get
        {
            final List <SelectOption> options = new List <SelectOption> ();    
            if(reviewList.cont.Email != NULL) { options.add(new SelectOption('', NONE_1)); }
            if(reviewList.cont.Email != NULL) { options.add(new SelectOption(EMAIL, EMAIL)); } 
            if(reviewList.cont.Additional_Email__c != NULL) { options.add(new SelectOption(ADD_EMAIL, ADD_EMAIL)); }
            return options;
        }
        set
        {
            reviewList.regg.Preferred_Communication__c = preferredComm;
        }
    }
Please rly me its urgent.
Visualforce Error
Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 158.109KB 

Hi all,
I am getting this error when i try to import large file using visual force page, can anyone please tell me how to show this error like "Please selct the file less than 100kb".
Error : Invalid date: 19-09-2016

In CSV im giving date like19-09-2016
My code is

detailObj.Date__c = date.ValueOf(csvRecordData[4]);
Still im getting error, i tried pasring also then also im getting the same error.
Not able to import contact hobbies csv file, please help me.
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.

here is my code

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;
        
        }
        
       
    }
}
Hi all! I need to write test class for wrapper class coverage. There is my controller:
public class StoreFrontController {
List<DisplayMerchandise> products;
public List<DisplayMerchandise> getProducts() {
if(products == null) {
products = new List<DisplayMerchandise>();
for(Merchandise__c item : [
SELECT Id, Name, Description__c, Price__c, Total_Inventory__c
FROM Merchandise__c]) {
products.add(new DisplayMerchandise(item));
}
}
return products;
}
// Inner class to hold online store details for item
public class DisplayMerchandise {

private Merchandise__c merchandise;
public DisplayMerchandise(Merchandise__c item) {
this.merchandise = item;
}
// Properties for use in the Visualforce view
public String name {
get { return merchandise.Name; }
}
public String description {
get { return merchandise.Description__c; }
}
public Decimal price {
get { return merchandise.Price__c; }
}
public Boolean inStock {
get { return (0 < merchandise.Total_Inventory__c); }
}
public Integer qtyToBuy { get; set; }
}
}
What Unit Test can I do for my inner class ?

Thanx
 
Hi all,

How to validate the csv file, if no data in rows and columns.
Please rly me.
 
Visualforce Error
Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 158.109KB 

Hi all,
I am getting this error when i try to import large file using visual force page, can anyone please tell me how to show this error like "Please selct the file less than 100kb".
Error : Invalid date: 19-09-2016

In CSV im giving date like19-09-2016
My code is

detailObj.Date__c = date.ValueOf(csvRecordData[4]);
Still im getting error, i tried pasring also then also im getting the same 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.

here is my code

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;
        
        }
        
       
    }
}