• Patrick Kaiser
  • NEWBIE
  • 75 Points
  • Member since 2015

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 12
    Replies
I am getting error 'Variable does not exist: selectedProducts' Request you to help me fix the error. I need to display the list of existing products . like the below pic. All objects are custom
User-added image

Controller class

global class ProductSearchPopupController {
    
    public String query {get; set;}
    public List<PricebookEntry__c> products {get; set;}
    public List<wrapProduct> wrapProductList {get; set;}
    public List<PricebookEntry__c> selectedProduct{get;set;}
    public List<QuoteLineitem__c> quoteLineList{get;set;}
    public List<wrapProduct> selectedWrapperList{get;set;}
    public Boolean normalList{get;set;}
    public Boolean selectedList{get;set;}
    public Boolean block{get;set;}
    public Boolean block1{get;set;}
    public Boolean block2{get;set;}
    public String SalesPrice {get; set;}
    public integer Discount {get; set;}
    public String Quantity {get; set;}
    public String ServiceDate {get; set;}
    Id recordId;
    
    
    public ProductSearchPopupController(ApexPages.StandardController controller){
        recordId = controller.getId();
        SalesPrice='';
        Discount=0;
        Quantity='';
        ServiceDate='';
        system.debug('recordId '+recordId);
        wrapProductList = new List<wrapProduct>();
        selectedWrapperList = new List<wrapProduct>();
        normalList = true;
        selectedList = false;
        block = true;
        block1 = false;
        block2 = false;
    }
    public PageReference runQuery(){
        if(Test.isRunningTest()){
            query='Test';
        }
        system.debug('this query '+query);
        if(query == null || query == ''){
            system.debug('query '+query);
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Info,'Please enter the product to be searched'));
            return null;
        }
        
        List<List<PricebookEntry__c>> searchResults=[FIND :query IN ALL FIELDS RETURNING PricebookEntry__c (id, Name, ProductCode__c, Product2Id__r.Product_Description__c,UnitPrice__c, UseStandardPrice__c)];
        system.debug('searchResults '+searchResults[0].size());
        System.debug('searchResults  result ' + searchResults[0]);       
        System.debug('oth  result ' + SearchResults[0]);
        if(searchResults[0]!=null){
            for(PricebookEntry__c a: searchResults[0]) {
                // As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
                wrapProductList.add(new wrapProduct(a));
                block = true;   block1 = true;   block2 = false;
            }
        }
        return null;
    }
    public void processSelected() {
   selectedProducts = new List<Product2__c>();
 
        for(wrapProducts wrapProductObj : wrapAccountList) {
            if(wrapProductObj.selected == true) {
                selectedProducts.add(wrapProductObj.acc);
            }
        }
    }
 
 
    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Account and a Boolean value
    public class wrapProducts {
        public Product2__c acc {get; set;}
        public Boolean selected {get; set;}
 
        //This is the contructor method. When we create a new wrapAccount object we pass a Account that is set to the acc property. We also set the selected value to false
        public wrapProducts(Product2__c a) {
            acc = a;
            selected = false;
        }
    }
    public PageReference ProceedWithSelectedToNextPage(){
        selectedWrapperList = new List<wrapProduct>();
        normalList = false;
        selectedList = true;
        for(wrapProduct selectedWrapObj: wrapProductList){
            system.debug('selectedWrapObj.selected  ---------'+selectedWrapObj.selected);
            if(selectedWrapObj.selected == true)
                selectedWrapperList.add(selectedWrapObj);
        }
        system.debug('selectedWrapperList size ---------'+selectedWrapperList.size());
        PageReference pageRef = new PageReference('/apex/AccountOpportunityTwoPage');
        pageRef.setRedirect(false);
        return pageRef;
    }
    
 
      
    public void SelectProduct() {
        selectedProduct = new List<PricebookEntry__c>();
        for(wrapProduct wrapProductObj : wrapProductList) {
            if(wrapProductObj.selected == true) {
                selectedProduct.add(wrapProductObj.acc);
                block = false;  block1 = false;  block2 = true;
                
            }
        }
    }
    
    public void GoBack() {
        block = true;
        block1 = true;
        block2 = false;
    }
    
    global   class wrapProduct {
        public PricebookEntry__c acc {get;set;}
        public Boolean selected {get;set;}
        public wrapProduct(PricebookEntry__c p) {
            this.acc = p;
            this.selected = false;
        }
    }
    
    public pagereference saveproduct(){
        List<QuoteLineitem__c> quoteLineList = new  List<QuoteLineitem__c>();
        if(Test.isRunningTest()){
            insertTestData();
        }
        if(!selectedProduct.isEmpty()){
            for(PricebookEntry__c sp:selectedProduct){
                system.debug('sp '+sp);
                QuoteLineitem__c qli = new QuoteLineitem__c();
                qli.QuotesId__c = recordId;
                qli.ListPrice__c = sp.UnitPrice__c;
                qli.UnitPrice__c = sp.UnitPrice__c;
                qli.Product2Id__c = sp.Product2Id__c;    
                if(Discount!=0 || Discount!=null){
                    qli.Discount__c = Discount;
                }
                quoteLineList.add(qli);
            }
            
            if(quoteLineList.size()>0){
                insert quoteLineList;
                PageReference pageRef = new PageReference('https://proseraa.lightning.force.com/lightning/r/Quotes__c/'+recordId+'/view');
                pageRef.setRedirect(true);
                return pageRef;
            }
        }
        return null;
    }
    public void insertTestData(){
        Product2__c testProduct = new Product2__c();
            testProduct.Name='Test product';
            insert testProduct;
            PricebookEntry__c testpbe = new PricebookEntry__c();
                testpbe.Name='Test PriceBookEntry';
                testpbe.UnitPrice__c =123;
                testpbe.Product2Id__c=testProduct.Id;
                insert testpbe;
            selectedProduct.add(testpbe);
    }
}
 Vf Code
User-added image<apex:page standardController="Quotes__c" extensions="ProductSearchPopupController" showHeader="false" sidebar="false" lightningStylesheets="true">
   
    <apex:form id="form" >
        <apex:pageMessages ></apex:pageMessages>
        <apex:messages />
        <div style="width 100%">
            <apex:pageBlock title="Add Products" id="block" rendered="{!block}"> 
                <centre>
                    <div align="center"  >
                   <apex:pageBlockSection columns="1" id="section" > 
                        Enter the product to be added and select Go<br/>
                        
                        <apex:inputText value="{!query}" id="query" style="width: 1200px; height: 40px;"/> 
                    </apex:pageBlockSection> 
                  </div>
                </centre>
                <right>
                <apex:commandButton value="Go" action="{!runQuery}" style="align: right:100px;border-style:solid;
                     color:white; position:relative;background-color:rgba(13, 112, 165, 1);"/>
                <apex:commandButton value="Cancel" action="{!cancel}" style="float: centre:200px ;border-style:solid;
                     color:rgb(21, 137, 238); background-color:white;" />
                      </right>
            </apex:pageBlock>
                
            <apex:pageBlock id="block1" rendered="{!block1}" >
                <apex:pageBlockSection columns="1">
                    <apex:pageBlockTable value="{!wrapProductList}" var="accWrap">
                        <apex:column >
                            <apex:facet name="header">
                                <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                            </apex:facet>
                            <apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
                        </apex:column>
                        <apex:column headerValue="Name">
                            <apex:outputLink value="#">{!accWrap.acc.Name}</apex:outputLink>       
                        </apex:column>
                        <apex:column headerValue="Product Code">
                            <apex:outputText value="{!accWrap.acc.ProductCode__c}"  />       
                        </apex:column>
                        <apex:column headerValue="Product Description">
                            <apex:outputText value="{!accWrap.acc.Product2Id__r.Product_Description__c}"  />       
                        </apex:column>
                        <apex:column headerValue="Unit Price">
                            <apex:outputText value="{!accWrap.acc.UnitPrice__c}"  />  
                        </apex:column>
                        <apex:column headerValue="Standard Price">
                            <apex:outputText value="{!accWrap.acc.UseStandardPrice__c}"  />  
                        </apex:column>
                    </apex:pageBlockTable>  
                    <apex:commandButton value="Next"   action="{!processSelected}" style="float: right;border-style:solid;
                     color:white; background-color:rgba(13, 112, 165, 1);align-items: right;justify-content:right;"/>  
                </apex:pageBlockSection>
            </apex:pageBlock>
        </div>
        <div>
            <apex:pageBlock id="block2" rendered="{!block2}" >
                <apex:pageblockSection title="All Products" collapsible="false" columns="3">
                    <apex:pageBlockTable value="{!selectedProduct}" var="c" id="table2" title="Selected Products">
                        <apex:column value="{!c.Name}" headerValue="Product Name"/>
                        <apex:column headerValue="Sales Price">
                            <apex:inputText value="{!c.UnitPrice__c}" id="UnitPrice" /> 
                        </apex:column>
                        <apex:column headerValue="Discount">
                            <apex:inputText value="{!discount}" id="discount" /> 
                        </apex:column>
                        <apex:column headerValue="Quantity">
                            <apex:inputText value="{!quantity}" id="quantity" /> 
                        </apex:column>
                    </apex:pageBlockTable>  
                </apex:pageblockSection>
                <apex:commandButton action="{!GoBack}" value="Back" style="border-style:solid;
                     color:white; background-color:rgba(13, 112, 165, 1);"/>
                <apex:commandButton action="{!saveproduct}" value="Save" style="float: right;border-style:solid;
                     color:white; background-color:rgba(13, 112, 165, 1);"/>
                <apex:commandButton value="Cancel" oncomplete="doRedirect()" style="float: right;border-style:solid;
                     color:rgb(21, 137, 238); background-color:white;"/>           
            </apex:pageBlock>
            </div>
           
        
    </apex:form>
</apex:page>
 
I am getting a SOAP response from a Apex callout. I am using the XMLStreamReader to find two tags. Once I get the values I am looking for I want to update the Account record fields with those values. When I look in the logs I am getting at least 100 loops through the XML response even after it finds my values. I would appreciate some help on the loop as well as updating my syntax once the values are found. 

Thanks! 
 
        String theSagittaIdValue; 
        String theSagittaCodeValue; 
        
        String bodyXML = res.getBody(); //grab the body of the response
        XmlStreamReader reader = new XmlStreamReader(bodyXML); //construct an XmlStreamReader object
        while (reader.hasNext()) { //while there are more XML events
            if (reader.getEventType() == XmlTag.START_ELEMENT) { //if this is the opening tag
                

                //Loop through to look for SagittaId
                if ('SagittaId' == reader.getlocalName()) {
                    while(reader.hasNext()) { //while there are more XML events
                        if (reader.getEventType() == XmlTag.END_ELEMENT) { //if this is the closing tag
                            break; //exist the loop
                        } else if (reader.getEventType() == XmlTag.CHARACTERS) { //if this is the content between the tags
                            theSagittaIdValue = reader.getText(); // grab the content
                        }
                        reader.next(); //advance to the next XML event
                    }
                }

                //Loop through to look for Sagitta Client Code 
                if ('SagittaCode' == reader.getLocalName()) { //if the tag is sagittacode
                    while(reader.hasNext()) { //while there are more XML events
                        if (reader.getEventType() == XmlTag.END_ELEMENT) { //if this is the closing tag
                            break; //exist the loop
                        } else if (reader.getEventType() == XmlTag.CHARACTERS) { //if this is the content between the tags
                            theSagittaCodeValue = reader.getText(); //grab the content
                            
                        }
                        reader.next(); //advance to the next XML event
                    }
                }
            }
        
        reader.next(); //advance to the next XML event
        
        //update the Account record fields with found values
            if(theSagittaIdValue != null) {
                accnt.SagittaID__c = theSagittaIdValue;
                update accnt;
            }

            if (theSagittaCodeValue != null) { 
                accnt.Client_Code__c = theSagittaCodeValue;
                update accnt;
            }



 
Hello Community

I've tried to build the AccountLocator project from Trailhead. The trailhead checks are all passed, but it dose give me an error "Something has gone wrong. Cannot read property 'lat' of null." every time i open the app and no markers are shown.

If i change the line of code from a) to b) the marker gets placed and there are no errors, but i can't find a solution to reach the function of the AccountLocator. On the Leaflet github i've found an simular error but i can't replicate the given solution.

I', quit new to javascript so i really could need some help with this issue.

Best Regards,
Patrick

a)
L.marker(latLng, {account: account}).addTo(map).on('click', function(event) {
                helper.navigateToDetailsView(event.target.options.account.Id);
            });
b)
var test = [37.784173, -122.401557]
L.marker([test[0],test[1]]).addTo(map);
My current AccountMapController.js
({
    jsLoaded: function(component, event, helper) {
        
        setTimeout(function() {
            var map = L.map('map', {zoomControl: false})
            .setView([37.784173, -122.401557], 14);
            L.tileLayer(
                'https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}',
                {
                    attribution: 'Tiles © Esri'
                }).addTo(map);
            component.set("v.map", map);
        });
    },
    
    accountsLoaded: function(component, event, helper) {
    
        // Add markers
        var map = component.get('v.map');
        var accounts = event.getParam('accounts');
        for (var i=0; i<accounts.length; i++) {
            var account = accounts[i];
            var latLng = [account.Location__Latitude__s, account.Location__Longitude__s];
            
            //var test = [37.784173, -122.401557]
            //L.marker([test[0],test[1]]).addTo(map);
            
            L.marker(latLng, {account: account}).addTo(map).on('click', function(event) {
                helper.navigateToDetailsView(event.target.options.account.Id);
            });

        }
    },
    
    accountSelected: function(component, event, helper) {
        // Center the map on the account selected in the list
        var map = component.get('v.map');
        var account = event.getParam("account");
        map.panTo([account.Location__Latitude__s, account.Location__Longitude__s]);
    }
    
})
Hi,

i want to display an image from a formular field, but in all Lex list views the given height of the image gets ignored. The following css code kills all my attemps to display the image in his default size.
.forceBaseListView tbody td img {
    height: 2.25rem;
    display: inline-block;
    vertical-align: middle;
}

I've made a simple test with an example from trailhead. Is there any option to override 'height: 2.25rem;'? Since Spring'16 Formula Fileds should be supported in list views, but it dosen't help if the images get resized so bad. 
 
CASE(Lead_Quality_Helper__c,
1, IMAGE("/img/samples/stars_100.gif", "1 star" ,16,93),
2, IMAGE("/img/samples/stars_200.gif", "2 stars",16,93),
3, IMAGE("/img/samples/stars_300.gif", "3 stars",16,93),
4, IMAGE("/img/samples/stars_400.gif", "4 stars",16,93),
5, IMAGE("/img/samples/stars_500.gif", "5 stars",16,93),
   IMAGE("/img/samples/stars_000.gif", "0 stars",16,93))
ResultingHTMLCode
 
I am getting error 'Variable does not exist: selectedProducts' Request you to help me fix the error. I need to display the list of existing products . like the below pic. All objects are custom
User-added image

Controller class

global class ProductSearchPopupController {
    
    public String query {get; set;}
    public List<PricebookEntry__c> products {get; set;}
    public List<wrapProduct> wrapProductList {get; set;}
    public List<PricebookEntry__c> selectedProduct{get;set;}
    public List<QuoteLineitem__c> quoteLineList{get;set;}
    public List<wrapProduct> selectedWrapperList{get;set;}
    public Boolean normalList{get;set;}
    public Boolean selectedList{get;set;}
    public Boolean block{get;set;}
    public Boolean block1{get;set;}
    public Boolean block2{get;set;}
    public String SalesPrice {get; set;}
    public integer Discount {get; set;}
    public String Quantity {get; set;}
    public String ServiceDate {get; set;}
    Id recordId;
    
    
    public ProductSearchPopupController(ApexPages.StandardController controller){
        recordId = controller.getId();
        SalesPrice='';
        Discount=0;
        Quantity='';
        ServiceDate='';
        system.debug('recordId '+recordId);
        wrapProductList = new List<wrapProduct>();
        selectedWrapperList = new List<wrapProduct>();
        normalList = true;
        selectedList = false;
        block = true;
        block1 = false;
        block2 = false;
    }
    public PageReference runQuery(){
        if(Test.isRunningTest()){
            query='Test';
        }
        system.debug('this query '+query);
        if(query == null || query == ''){
            system.debug('query '+query);
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Info,'Please enter the product to be searched'));
            return null;
        }
        
        List<List<PricebookEntry__c>> searchResults=[FIND :query IN ALL FIELDS RETURNING PricebookEntry__c (id, Name, ProductCode__c, Product2Id__r.Product_Description__c,UnitPrice__c, UseStandardPrice__c)];
        system.debug('searchResults '+searchResults[0].size());
        System.debug('searchResults  result ' + searchResults[0]);       
        System.debug('oth  result ' + SearchResults[0]);
        if(searchResults[0]!=null){
            for(PricebookEntry__c a: searchResults[0]) {
                // As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
                wrapProductList.add(new wrapProduct(a));
                block = true;   block1 = true;   block2 = false;
            }
        }
        return null;
    }
    public void processSelected() {
   selectedProducts = new List<Product2__c>();
 
        for(wrapProducts wrapProductObj : wrapAccountList) {
            if(wrapProductObj.selected == true) {
                selectedProducts.add(wrapProductObj.acc);
            }
        }
    }
 
 
    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Account and a Boolean value
    public class wrapProducts {
        public Product2__c acc {get; set;}
        public Boolean selected {get; set;}
 
        //This is the contructor method. When we create a new wrapAccount object we pass a Account that is set to the acc property. We also set the selected value to false
        public wrapProducts(Product2__c a) {
            acc = a;
            selected = false;
        }
    }
    public PageReference ProceedWithSelectedToNextPage(){
        selectedWrapperList = new List<wrapProduct>();
        normalList = false;
        selectedList = true;
        for(wrapProduct selectedWrapObj: wrapProductList){
            system.debug('selectedWrapObj.selected  ---------'+selectedWrapObj.selected);
            if(selectedWrapObj.selected == true)
                selectedWrapperList.add(selectedWrapObj);
        }
        system.debug('selectedWrapperList size ---------'+selectedWrapperList.size());
        PageReference pageRef = new PageReference('/apex/AccountOpportunityTwoPage');
        pageRef.setRedirect(false);
        return pageRef;
    }
    
 
      
    public void SelectProduct() {
        selectedProduct = new List<PricebookEntry__c>();
        for(wrapProduct wrapProductObj : wrapProductList) {
            if(wrapProductObj.selected == true) {
                selectedProduct.add(wrapProductObj.acc);
                block = false;  block1 = false;  block2 = true;
                
            }
        }
    }
    
    public void GoBack() {
        block = true;
        block1 = true;
        block2 = false;
    }
    
    global   class wrapProduct {
        public PricebookEntry__c acc {get;set;}
        public Boolean selected {get;set;}
        public wrapProduct(PricebookEntry__c p) {
            this.acc = p;
            this.selected = false;
        }
    }
    
    public pagereference saveproduct(){
        List<QuoteLineitem__c> quoteLineList = new  List<QuoteLineitem__c>();
        if(Test.isRunningTest()){
            insertTestData();
        }
        if(!selectedProduct.isEmpty()){
            for(PricebookEntry__c sp:selectedProduct){
                system.debug('sp '+sp);
                QuoteLineitem__c qli = new QuoteLineitem__c();
                qli.QuotesId__c = recordId;
                qli.ListPrice__c = sp.UnitPrice__c;
                qli.UnitPrice__c = sp.UnitPrice__c;
                qli.Product2Id__c = sp.Product2Id__c;    
                if(Discount!=0 || Discount!=null){
                    qli.Discount__c = Discount;
                }
                quoteLineList.add(qli);
            }
            
            if(quoteLineList.size()>0){
                insert quoteLineList;
                PageReference pageRef = new PageReference('https://proseraa.lightning.force.com/lightning/r/Quotes__c/'+recordId+'/view');
                pageRef.setRedirect(true);
                return pageRef;
            }
        }
        return null;
    }
    public void insertTestData(){
        Product2__c testProduct = new Product2__c();
            testProduct.Name='Test product';
            insert testProduct;
            PricebookEntry__c testpbe = new PricebookEntry__c();
                testpbe.Name='Test PriceBookEntry';
                testpbe.UnitPrice__c =123;
                testpbe.Product2Id__c=testProduct.Id;
                insert testpbe;
            selectedProduct.add(testpbe);
    }
}
 Vf Code
User-added image<apex:page standardController="Quotes__c" extensions="ProductSearchPopupController" showHeader="false" sidebar="false" lightningStylesheets="true">
   
    <apex:form id="form" >
        <apex:pageMessages ></apex:pageMessages>
        <apex:messages />
        <div style="width 100%">
            <apex:pageBlock title="Add Products" id="block" rendered="{!block}"> 
                <centre>
                    <div align="center"  >
                   <apex:pageBlockSection columns="1" id="section" > 
                        Enter the product to be added and select Go<br/>
                        
                        <apex:inputText value="{!query}" id="query" style="width: 1200px; height: 40px;"/> 
                    </apex:pageBlockSection> 
                  </div>
                </centre>
                <right>
                <apex:commandButton value="Go" action="{!runQuery}" style="align: right:100px;border-style:solid;
                     color:white; position:relative;background-color:rgba(13, 112, 165, 1);"/>
                <apex:commandButton value="Cancel" action="{!cancel}" style="float: centre:200px ;border-style:solid;
                     color:rgb(21, 137, 238); background-color:white;" />
                      </right>
            </apex:pageBlock>
                
            <apex:pageBlock id="block1" rendered="{!block1}" >
                <apex:pageBlockSection columns="1">
                    <apex:pageBlockTable value="{!wrapProductList}" var="accWrap">
                        <apex:column >
                            <apex:facet name="header">
                                <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                            </apex:facet>
                            <apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
                        </apex:column>
                        <apex:column headerValue="Name">
                            <apex:outputLink value="#">{!accWrap.acc.Name}</apex:outputLink>       
                        </apex:column>
                        <apex:column headerValue="Product Code">
                            <apex:outputText value="{!accWrap.acc.ProductCode__c}"  />       
                        </apex:column>
                        <apex:column headerValue="Product Description">
                            <apex:outputText value="{!accWrap.acc.Product2Id__r.Product_Description__c}"  />       
                        </apex:column>
                        <apex:column headerValue="Unit Price">
                            <apex:outputText value="{!accWrap.acc.UnitPrice__c}"  />  
                        </apex:column>
                        <apex:column headerValue="Standard Price">
                            <apex:outputText value="{!accWrap.acc.UseStandardPrice__c}"  />  
                        </apex:column>
                    </apex:pageBlockTable>  
                    <apex:commandButton value="Next"   action="{!processSelected}" style="float: right;border-style:solid;
                     color:white; background-color:rgba(13, 112, 165, 1);align-items: right;justify-content:right;"/>  
                </apex:pageBlockSection>
            </apex:pageBlock>
        </div>
        <div>
            <apex:pageBlock id="block2" rendered="{!block2}" >
                <apex:pageblockSection title="All Products" collapsible="false" columns="3">
                    <apex:pageBlockTable value="{!selectedProduct}" var="c" id="table2" title="Selected Products">
                        <apex:column value="{!c.Name}" headerValue="Product Name"/>
                        <apex:column headerValue="Sales Price">
                            <apex:inputText value="{!c.UnitPrice__c}" id="UnitPrice" /> 
                        </apex:column>
                        <apex:column headerValue="Discount">
                            <apex:inputText value="{!discount}" id="discount" /> 
                        </apex:column>
                        <apex:column headerValue="Quantity">
                            <apex:inputText value="{!quantity}" id="quantity" /> 
                        </apex:column>
                    </apex:pageBlockTable>  
                </apex:pageblockSection>
                <apex:commandButton action="{!GoBack}" value="Back" style="border-style:solid;
                     color:white; background-color:rgba(13, 112, 165, 1);"/>
                <apex:commandButton action="{!saveproduct}" value="Save" style="float: right;border-style:solid;
                     color:white; background-color:rgba(13, 112, 165, 1);"/>
                <apex:commandButton value="Cancel" oncomplete="doRedirect()" style="float: right;border-style:solid;
                     color:rgb(21, 137, 238); background-color:white;"/>           
            </apex:pageBlock>
            </div>
           
        
    </apex:form>
</apex:page>
 
I am trying to revise my scratch org definition file to create an enterprise org vs. developer and am reconciling all the fallout related.  One issue I am having that I cannot find a solution for is enabling Asset Sharing in my new enterprise scratch.  I haven't had issues before changing the org type, so either dev environments have this enabled by default or there's some other issue.  Anyone have suggestions?User-added image
I'm currently working on Challenge 3 and am dealing with trying to fix this error:
Challenge Not yet complete... here's what's wrong: 
The report 'Open Support Cases' contains records of the incorrect status. Please check the filter.
 
For the Open Support Cases, I created a Custom Report Type linking Accounts and Cases and have the groupings and fields set up as specified. For the filter, I've tried "Closed equals False" and "Status not equal to Closed" for the Cases, but neither of those worked.

If anyone who has passed this challenge can provide input on what's wrong with this report. It'll be much appreciated.

Open Support Cases Report Screenshot
I am getting a SOAP response from a Apex callout. I am using the XMLStreamReader to find two tags. Once I get the values I am looking for I want to update the Account record fields with those values. When I look in the logs I am getting at least 100 loops through the XML response even after it finds my values. I would appreciate some help on the loop as well as updating my syntax once the values are found. 

Thanks! 
 
        String theSagittaIdValue; 
        String theSagittaCodeValue; 
        
        String bodyXML = res.getBody(); //grab the body of the response
        XmlStreamReader reader = new XmlStreamReader(bodyXML); //construct an XmlStreamReader object
        while (reader.hasNext()) { //while there are more XML events
            if (reader.getEventType() == XmlTag.START_ELEMENT) { //if this is the opening tag
                

                //Loop through to look for SagittaId
                if ('SagittaId' == reader.getlocalName()) {
                    while(reader.hasNext()) { //while there are more XML events
                        if (reader.getEventType() == XmlTag.END_ELEMENT) { //if this is the closing tag
                            break; //exist the loop
                        } else if (reader.getEventType() == XmlTag.CHARACTERS) { //if this is the content between the tags
                            theSagittaIdValue = reader.getText(); // grab the content
                        }
                        reader.next(); //advance to the next XML event
                    }
                }

                //Loop through to look for Sagitta Client Code 
                if ('SagittaCode' == reader.getLocalName()) { //if the tag is sagittacode
                    while(reader.hasNext()) { //while there are more XML events
                        if (reader.getEventType() == XmlTag.END_ELEMENT) { //if this is the closing tag
                            break; //exist the loop
                        } else if (reader.getEventType() == XmlTag.CHARACTERS) { //if this is the content between the tags
                            theSagittaCodeValue = reader.getText(); //grab the content
                            
                        }
                        reader.next(); //advance to the next XML event
                    }
                }
            }
        
        reader.next(); //advance to the next XML event
        
        //update the Account record fields with found values
            if(theSagittaIdValue != null) {
                accnt.SagittaID__c = theSagittaIdValue;
                update accnt;
            }

            if (theSagittaCodeValue != null) { 
                accnt.Client_Code__c = theSagittaCodeValue;
                update accnt;
            }



 
Hi,

yesterday I finished the Build an Account Geolocation App . Everything worked fine. Today I wanted to check it again, but now the map isn't working anymore. The map doesn't fill the div and it's not possible to swipe. The markers aren't set.

The app looks like this now:

trailhead accoun-geolocation-app map error

It should look like this. There are no errors in Chrome dev console

Any ideas ?
Hello Community

I've tried to build the AccountLocator project from Trailhead. The trailhead checks are all passed, but it dose give me an error "Something has gone wrong. Cannot read property 'lat' of null." every time i open the app and no markers are shown.

If i change the line of code from a) to b) the marker gets placed and there are no errors, but i can't find a solution to reach the function of the AccountLocator. On the Leaflet github i've found an simular error but i can't replicate the given solution.

I', quit new to javascript so i really could need some help with this issue.

Best Regards,
Patrick

a)
L.marker(latLng, {account: account}).addTo(map).on('click', function(event) {
                helper.navigateToDetailsView(event.target.options.account.Id);
            });
b)
var test = [37.784173, -122.401557]
L.marker([test[0],test[1]]).addTo(map);
My current AccountMapController.js
({
    jsLoaded: function(component, event, helper) {
        
        setTimeout(function() {
            var map = L.map('map', {zoomControl: false})
            .setView([37.784173, -122.401557], 14);
            L.tileLayer(
                'https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}',
                {
                    attribution: 'Tiles © Esri'
                }).addTo(map);
            component.set("v.map", map);
        });
    },
    
    accountsLoaded: function(component, event, helper) {
    
        // Add markers
        var map = component.get('v.map');
        var accounts = event.getParam('accounts');
        for (var i=0; i<accounts.length; i++) {
            var account = accounts[i];
            var latLng = [account.Location__Latitude__s, account.Location__Longitude__s];
            
            //var test = [37.784173, -122.401557]
            //L.marker([test[0],test[1]]).addTo(map);
            
            L.marker(latLng, {account: account}).addTo(map).on('click', function(event) {
                helper.navigateToDetailsView(event.target.options.account.Id);
            });

        }
    },
    
    accountSelected: function(component, event, helper) {
        // Center the map on the account selected in the list
        var map = component.get('v.map');
        var account = event.getParam("account");
        map.panTo([account.Location__Latitude__s, account.Location__Longitude__s]);
    }
    
})
Hi,

I want to fire a workflow rule when the time periond 2016 to 2015, so how i can achieve this.

Please suggest.
example:   renewaldate= 01-13-2014( workflow not fired)
                renewaldate=01-15-2015(workflow fired)

Regards,
Raj
 
Hi all,

how many weeks before new upcoming release i can refresh my sandboxes and it will appear new version of release maintenance.

Thank you

Peter