• Shruti Suman Mishra
  • NEWBIE
  • 8 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 8
    Replies
Hi,

I am facing below error while trying to verify Step 8-
Error: Please ensure that product2Extension and its methods are still working as specified in the earlier challenge.

Code below:
public class Product2Extension {

    public List<ProductWrapper> productsToInsert {get;set;}

    public Product2Extension(ApexPages.StandardController controller){
        productsToInsert = new List<ProductWrapper>();
        addRows();
    }
    
    public List<SelectOption> GetFamilyOptions() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption(Constants.SELECT_ONE, Constants.SELECT_ONE));
        for(PickListEntry eachPicklistValue : Constants.PRODUCT_FAMILY) {
            options.add(new SelectOption(eachPicklistValue.getValue(), eachPicklistValue.getLabel()));
        }
            return options;
    }
    
    public void AddRows(){
        for (Integer i=0; i<Constants.DEFAULT_ROWS; i++ ){
            productsToInsert.add(new ProductWrapper());
        }
    }

    public List<ChartHelper.ChartData> GetInventory(){
        return ChartHelper.GetInventory();
    }

    public PageReference Save(){
        SavePoint sp = Database.setSavepoint();
        Integer insertedCount = 0;
        try {
            List<Product2> newProducts = new List<Product2>();
            List<PriceBookEntry> pbeList = new List<PriceBookEntry>();
            List<ProductWrapper> filteredProductWrappers = new List<ProductWrapper>();
            for(ProductWrapper eachPW : productsToInsert) {
                if(!String.isBlank(eachPW.productRecord.Name) && !String.isBlank(eachPW.productRecord.Family) && 
                   eachPW.productRecord.Family!=Constants.SELECT_ONE && eachPW.productRecord.isActive &&
                   eachPW.pricebookEntryRecord.UnitPrice!=null && eachPW.productRecord.Initial_Inventory__c!=null && 
                   eachPW.productRecord.Initial_Inventory__c!=0 && eachPW.pricebookEntryRecord.UnitPrice!=0) {
                       filteredProductWrappers.add(eachPW);
                   }                
            }
            for(ProductWrapper eachPW : filteredProductWrappers) {
                newProducts.add(eachPW.productRecord);
            }
            Database.SaveResult[] productSaveResults = Database.insert(newProducts, false);
            for(Integer i=0; i<productSaveResults.size(); i++) {
                if(productSaveResults[i].isSuccess()) {
                    PriceBookEntry pbe = filteredProductWrappers[i].pricebookEntryRecord;
                    pbe.Product2Id = productSaveResults[i].getId();
                    pbe.IsActive = true;
                    pbe.Pricebook2Id = Constants.STANDARD_PRICEBOOK_ID;
                    pbeList.add(pbe);
                    insertedCount++;
                }
            }
            Database.SaveResult[] pbeSaveResults = Database.insert(pbeList, false);
            
            //If successful clear the list and display an informational message
            apexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO,insertedCount + ' Inserted'));
            productsToInsert.clear();   //Do not remove
            addRows();  //Do not remove
        } 
        catch (Exception e){
            System.debug('Exception occured:'+e.getMessage());
            Database.rollback(sp);
            apexPages.addMessage(new ApexPages.message(ApexPages.Severity.ERROR, Constants.ERROR_MESSAGE));            
        }
        return null;
    }
    
    public class ProductWrapper {
        public Product2 productRecord {get;set;}
        public PriceBookEntry pricebookEntryRecord {get;set;}
        
        public ProductWrapper() {
            productRecord = new Product2();
            pricebookEntryRecord = new PricebookEntry();
        }
    }
}
Hi,
Call recording of IC integrated softphone is being saved at external location. I would like to fetch the recording from external folder into Salesforce. Please let me know if anyone has worked through such requirement.
Hi,
Is there any way to navigate to other Native App from Lightning Component? 

eg. I've a Facebook Button on my Lightning Component. On Click of button, it should navigate to Facebook Mobile App. Is it possible? If yes, how? Any help is appreciated.
Hi,

I've a code where I need to write select queries for multiple objects, I understand that I can use Iterable<String> return type for Batch start method, but as I'm expecting huge output, can I use QueryLocator to pass list of Queries and bypass the Governer Limit?

e.g. 
global Database.QueryLocator start(Database.BatchableContext bc) {
     List<String> queries=new List<String>();
            String query1 = 'SELECT Id FROM Contact';
            queries.add(query1);
            }
            String query2='SELECT Id FROM Account';
            queries.add(query2);
            
       return Database.getQueryLocator(queries);
}

Is there any other way to bypass governer limit?
 public Blob getURLAttachment(string docurl){
            String remoteContentURL=docurl;
            Http http=new Http();
            Httprequest request=new Httprequest();
            request.setEndpoint(remoteContentURL);
            request.setMethod('GET');
            request.setTimeout(120000);
            Httpresponse response= http.send(request);
            Blob remoteContentAsBlob=response.getBodyAsBlob();   
           return remoteContentAsBlob;
    } 
Hi All,

I am trying to authorize an org (Dev org not sandbox) from VS Code and I am in my Company network and default port Id 1717 wouldnt work for me. I have followed the below steps to create a Connected App and change port number in sfdx-project.json file. But still its taking me to old 1717 localhost even after changin the port number.

From Connected App..
User-added image

From VSCode project setup..

User-added image

I have also tried to put 443 in the redirected URL instead of 1717. But it doesnt work either.

Is there any mistake that I have done while setting up the Conncted App ? BTW, I am not using JWT AUthentication. Its just web based authentication. How else can I change the default port number ?

PS : I have used both "oauthLocalPort" : "443" and "oauthLocalPort" : 443. 
 
Getting this error when I try to add my Towermaps to a new app builder page:
User-added image

Here are the codes I have based on the trailhead exercise:

TowerMapUtilClass:
public inherited sharing class TowerMapUtilClass {
     public static List<sObject> queryObjects(String theObject, List<String> theFields, String theFilter, String sortField, String sortOrder) {
          String theQuery = 'SELECT ' + string.join(theFields, ',');
          theQuery += ' FROM ' + theObject;
          if(!String.isEmpty(theFilter)) {
               theQuery += ' WHERE ' + theFilter;
          }
          if(!String.isEmpty(sortField)) {
               theQuery += ' ORDER BY ' + sortField;
               if(!String.isEmpty(sortOrder)) {
                    theQuery += ' ' + sortOrder;
               }
          }
          return database.query(theQuery);
     }


TowerMapControllerClass:
public inherited sharing class TowerMapControllerClass {
     @AuraEnabled
     public static List<Tower__c> getAllTowers() {
          String theObject = 'Tower__c';
          List<String> theFields = new List<String>{'Id', 'Name', 'State__r.Name', 'Tower_Location__Latitude__s', 'Tower_Location__Longitude__s'};
          String theFilter = '';
          String sortField = 'Name';
          String sortOrder = 'ASC';
          List<Tower__c> allTowers = TowerMapUtilClass.queryObjects(theObject, theFields, theFilter, sortField, sortOrder);
          return allTowers;
     }
Towermap:
<aura:component implements="flexipage:availableForAllPageTypes" controller="TowerMapControllerClass" access="global" >
     <aura:attribute name="mapMarkers" type="Object" access="PRIVATE" />
     <aura:attribute name="markersTitle" type="String" access="PRIVATE" />
     <aura:handler name="init" value="{!this}" action="{!c.handleInit}"/>
     <aura:if isTrue="{!!empty(v.mapMarkers)}" >
          <lightning:map mapMarkers="{!v.mapMarkers}" markersTitle="{!v.markersTitle}" zoomLevel="5"/>
 
     </aura:if>
</aura:component>

Towermap Controller:
({
     handleInit: function (component, event, helper) {
          helper.initHelper(component, event, helper);
     }
})
Towermap Helper:
({
     initHelper : function(component, event, helper) {
          helper.utilSetMarkers(component, event, helper);
     },
     utilSetMarkers : function(component, event, helper) {
          let action = component.get("c.getAllTowers");
          action.setCallback(this, function(response) {
               const data = response.getReturnValue();
               const dataSize = data.length;
               let markers = [];
               for(let i=0; i < dataSize; i += 1) {
                    const Tower = data[i];
                    markers.push({
                        'location': {
                             'Latitude' : Tower.Tower_Location__Latitude__s,
                             'Longitude' : Tower.Tower_Location__Longitude__s
                        },
                        'icon': 'utility:Tower',
                        'title' : Tower.Name,
                        'description' : Tower.Name + ' Tower Location at ' + Tower.State__r.Name
                   });
               }
               component.set('v.markersTitle', 'Out and About Communications Tower Locations');
               component.set('v.mapMarkers', markers);
          });
          $A.enqueueAction(action);
     }
})

I also created the cutom object Tower.

Anyone know where my break is?

Thanks!

Erin
"Challenge Not yet complete... here's what's wrong: 
The 'Name' and 'Feedback' fields either do not appear on the new action page layout or they are not the only fields present."

I'm lost on how to fix this... maybe I'm overthinking. Can someone pount me to where I'm validate the "new action page layout" fields?
I have tried to get past this module with no success and keep getting the error "The 'Name' and 'Feedback' fields either do not appear on the new action page layout or they are not the only fields present."  It appears that I have done this as described.  What am I missing? Thanks!
Hi,
I'm unable to complete 'Create a User, Skill, and Configuration' which is part of live agent project.
https://trailhead.salesforce.com/projects/build_branded_chat/steps/build_branded_chat_create

Error: The Skill Support is not assigned to one or more of the given profiles. Please follow instructions carefully.

Please Note: in the trail they mentioned to use Standard User & System Administrator Profiles. When i checked with both the profiles, Standard User  Profile it was not assigned the skill. Also when i tried to edit it, I'm not able to assign the Skill to that Profile. 
 
Hi,

I've a code where I need to write select queries for multiple objects, I understand that I can use Iterable<String> return type for Batch start method, but as I'm expecting huge output, can I use QueryLocator to pass list of Queries and bypass the Governer Limit?

e.g. 
global Database.QueryLocator start(Database.BatchableContext bc) {
     List<String> queries=new List<String>();
            String query1 = 'SELECT Id FROM Contact';
            queries.add(query1);
            }
            String query2='SELECT Id FROM Account';
            queries.add(query2);
            
       return Database.getQueryLocator(queries);
}

Is there any other way to bypass governer limit?