• Janno Rip
  • NEWBIE
  • 100 Points
  • Member since 2018
  • CRM Manager

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 40
    Questions
  • 37
    Replies

Hello everyone,

I guess this is as standard as it gets but I still struggle as newby in apex classes and triggers.

I have an apex class that - as for now - is being invoked by a process builder. But in regards of performance I want to switch to an apex trigger.

Here is the class:

Public class generateQuotePdfDocumentByTrigger{

//https://github.com/Rakeshistom/Auto-Generates-Quote-PDF

public static void QuoteCreate (List<Id> quoteIds) {

    //Initialize the quote url
    String quoteUrl = '/quote/quoteTemplateDataViewer.apexp?';
    
    //Get the Quote Template Id from Custom Settings
    String quoteTemplateId = Label.QuoteTemplateId;
    
    //List variable to get all the Quote Documents
    List<QuoteDocument> lstQuoteDoc = new List<QuoteDocument>();
    
    if(!quoteIds.isEmpty() && quoteIds.size() > 0) {
        
        for(Id quoteId :quoteIds) {
            //Construct the quote URL to generate PDF
            quoteUrl += 'id=' + quoteId;
            quoteUrl += '&headerHeight=197&footerHeight=80';
            quoteUrl += '&summlid=' + quoteTemplateId;
            
            //call the quote url
            PageReference pageRef = new PageReference(quoteUrl);
            
            //get the quotePdf
            Blob quoteBlob;
            
            if(Test.isRunningTest()) {
                quoteBlob = Blob.valueOf('Generate Pdf');
            } else {
                quoteBlob = pageRef.getContentAsPDF();
            }
            
            //initialze the QuoteDocument to hold the quote pdf for insertion
            QuoteDocument quoteDoc = new QuoteDocument();
            quoteDoc.Document = quoteBlob;
            quoteDoc.QuoteId = quoteId;
            lstQuoteDoc.add(quoteDoc);
        }
    }
    
    if(!lstQuoteDoc.isEmpty() && lstQuoteDoc.size() > 0) {
        Database.insert(lstQuoteDoc);
    }

}
}
What I like the trigger to do is the following:

After "Create_PDF__c" is set to "true" - invoke the apex class.

This is what I got so for but yeah...

Error: Compile Error: Method does not exist or incorrect signature: void generateQuotePdfDocumentByTrigger() from the type CreatePDFQuote_JTo at line 7 column 9
trigger CreatePDFQuote_JTo on Quote (after update) 

{
    for(Quote currentQuote : Trigger.New)
    {
        if(currentQuote.Create_PDF__c == true ) {
        generateQuotePdfDocumentByTrigger();
        }
    }
    
  
}

Thanks in Advance!
Hello there,

I have a bit of trouble correctly displaying my data:

my apex class:
 
public class QuoteList {

public Opportunity currentOpp {get;set;}
public List<Quote> quotes  {get;set;} 

 public QuoteList(ApexPages.StandardController stdController) {
     currentOpp  = [SELECT Id FROM Opportunity WHERE ID =: stdController.getID()];
     }
    
public PageReference getPdfs() {         

quotes = [SELECT Id,Name,(SELECT Id,CreatedDate,Name,ContentVersionDocumentId,QuoteId FROM QuoteDocuments)FROM Quote WHERE OpportunityId = :currentOpp.id];


return null;
}
}

my visualforce page:
 
<apex:page standardcontroller="Opportunity" extensions="QuoteList" lightningStylesheets="true" action="{!getPdfs}">  
       
    
  <apex:form >
<apex:pageBlock >  
    <apex:repeat value="{!quotes}" var="quote">
    
      <apex:pageBlockTable value="{!quote.QuoteDocuments}" var="pdf" >

        <apex:column headerValue="Name">
        <apex:outputlink value="https://meinestadt--syncs.my.salesforce.com/servlet/servlet.FileDownload?file={!pdf.id}" target="_blank">{!pdf.Name}</apex:outputlink>
       </apex:column>
       
        <apex:column value="{!pdf.CreatedDate}"/>
       
     </apex:pageBlockTable>
  
    </apex:repeat>

 </apex:pageBlock>
 </apex:form>
</apex:page>

the result:

User-added image
I am doing almost identical code (class & vf) when I display all contacts from the account related to a task - this works just fine:

User-added image
Where did I go wrong?

Thanks!
Hello guys,

I am trying to automate the generation of quote pdfs. I have found a really nice blog entry on that topic here: https://automationchampion.com/2020/06/23/getting-started-with-process-builder-part-97-now-generating-a-quote-pdf-is-a-breeze-learn-how/?fbclid=IwAR0QHkSOjk2TG9hzdthNAbJ88hQjKjGX8FuV_UicCcnT_N-sfp5PJBicXVo

Everything works fine except for the fact that pdf just turns out completely blank.

Here the code from github:
Public class generateQuotePdfDocument{
    @InvocableMethod   

    //https://github.com/Rakeshistom/Auto-Generates-Quote-PDF

    public static void LeadAssign(List<Id> quoteIds)  
    { 
    //Initialize the quote url
    String quoteUrl = '/quote/quoteTemplateDataViewer.apexp?';
    
    //Get the Quote Template Id from Custom Settings
    String quoteTemplateId = Label.QuoteTemplateId;
    
    //List variable to get all the Quote Documents
    List<QuoteDocument> lstQuoteDoc = new List<QuoteDocument>();
    
    if(!quoteIds.isEmpty() && quoteIds.size() > 0) {
        
        for(Id quoteId :quoteIds) {
            //Construct the quote URL to generate PDF
            quoteUrl += 'id=' + quoteId;
            quoteUrl += '&headerHeight=197&footerHeight=10';
            quoteUrl += '&summlid=' + quoteTemplateId;
            
            //call the quote url
            PageReference pageRef = new PageReference(quoteUrl);
            
            //get the quotePdf
            Blob quoteBlob;
            
            if(Test.isRunningTest()) {
                quoteBlob = Blob.valueOf('Generate Pdf');
            } else {
                quoteBlob = pageRef.getContentAsPDF();
            }
            
            //initialze the QuoteDocument to hold the quote pdf for insertion
            QuoteDocument quoteDoc = new QuoteDocument();
            quoteDoc.Document = quoteBlob;
            quoteDoc.QuoteId = quoteId;
            lstQuoteDoc.add(quoteDoc);
        }
    }
    
    if(!lstQuoteDoc.isEmpty() && lstQuoteDoc.size() > 0) {
        Database.insert(lstQuoteDoc);
    }
    }
    }
Any thoughts what might be the problem?
Hello guys,

I have the following feature request:

On the opportunity level I want to see all pdfs from all quotes from that very opportunity. So I think (hopefully) this is something Apex can do for me. 

As I am not much of a developer I was thinking I need something like:
ListOfPDFs = [SELECT Id, ... FROM Quote (SELECT Id,... FROM QuotePDF) WHERE Opportunity.Id = currentOpportunity
In the end I want to display it as a simple table in visualforce. 

Any advice is appreciated

Thanks a lot!
in my Visualforce page I have created an apex:pageblock that consists of an apex:selectList for sorting and an apex:tabPanel (Leads & Accounts)

User-added imageNow when I switch between these tabs the entire visualforce page reloads which includes a google map. This not what I want and at the same time can't figure out why this is happening. What 'action' tells the page to reRender when switching tabs?

I only want the pageblock to reRender. This behaviour is fine when I change the value of the 'selectList' element in order to sort the records inside the tabs.

Here is the code that handles the pageblock:
 
<apex:pageblock id="sort">
        <apex:form >
            sortieren nach:   <apex:selectList value="{!selectedField}" size="1">
                                 <apex:actionSupport event="onchange" rerender="sort" action="{!findNearbyPotentials}"></apex:actionSupport>
                                    <apex:selectOption itemValue="Distance" itemLabel="Entfernung"/>
                                    <apex:selectOption itemValue="Jobads" itemLabel="Anzahl Anzeigen"/>
                              </apex:selectList>
         </apex:form>


    <apex:tabPanel >
     <!-- TAB LEADS -->
      <apex:tab label="Leads ({!warehouses.size})" disabled="{!IF(warehouses.size = 0,true,false)}" >
       <apex:pageBlockSectionItem >
        <apex:outputPanel styleClass="container-fluid">
         <div style="height:300px; overflow:auto !important;">     
          <apex:repeat value="{!warehouses}" var="war">

             <style type="text/css">
               .col1 {width:5px; text-align:left;}
               .col2 {width:400px; text-align:left;}
             </style>

              <apex:panelGrid columns="2" columnClasses="col1, col2" onmouseover="this.style.backgroundColor='#e2ecf1'" onmouseout="this.style.backgroundColor =''">
                <apex:image url="{!IF(war.Nicht_zugewiesene_Leadevents_Counter__c > 0,URLFOR($Resource.mitle),IF(war.WirtschaftszweigWZ08__c = currentAccount.WirtschaftszweigWZ08__c && war.Mitarbeiternzahl_final__c = currentAccount.Mitarbeiternzahl_final__c,URLFOR($Resource.perfect_fit), 
                      URLFOR($Resource.ms_marker)))}" styleClass="imageStyle" id="MyImage" onmouseover="ImageOver(this)" onmouseout="ImageNormal(this)"/> 
                  <apex:panelGroup >

                                <!-- Hover for Detail -->   
                                <a id="{!war.Id}"
                                onmouseover="LookupHoverDetail.getHover('{!war.Id}', '/{!war.Id}/m?retURL={!war.Id}&isAjaxRequest=1').show();"
                                onmouseout="LookupHoverDetail.getHover('{!war.Id}').hide();"
                                onfocus="LookupHoverDetail.getHover('{!war.Id}', '/{!war.Id}/m?retURL={!war.Id}&isAjaxRequest=1').show();"
                                onblur="LookupHoverDetail.getHover('{!war.Id}').hide();"
                                href="/{!war.Id}" target="_blank"> 
                                {!war.company}
                                 </a> <br/>

                                <!-- Jump to location and highlight -->
                                <apex:form > 
                                 <apex:commandLink action="{!findNearbyPotentials}" value="{!war.Street}, {!war.PostalCode} {!war.City}" reRender="map">  
                                     <apex:param name="HoverLead" value="{!war.id}" assignTo="{!HoverLead}" /> 
                                      <apex:param name="center" value="{!war.MapCurrentAddress__c}" assignTo="{!mapCenter}" />
                                      <apex:param name="zoom" value="13" assignTo="{!zoom}"/>
                                      <apex:param name="HoverAccount" value="" assignTo="{!HoverAccount}" /> 
                                 </apex:commandLink>  
                                </apex:form>  

                                 <!-- Distanz -->
                                 <apex:variable var="url" value="GoogleDistance | https://www.google.com/maps?saddr=+{!currentAccount.Geolocation__c}&daddr=+{!war.Geolocation__c}" />
                                 <apex:outputLink rendered="{!IF(NOT(CONTAINS(selectedField,'Jobads')), true, false)}" value="{!MID(url, FIND('|', url) + 1, LEN(url))}" target="_blank">{!distances[war.id]}</apex:outputLink>  

                                 <!-- Anzahl Anzeigen -->             
                                 <apex:outputLink rendered="{!IF(CONTAINS(selectedField,'Jobads'), true, false)}" value="{!war.indexurl__c}" target="_blank">{!war.AD_MS_Rel_Anzahl_bez__c} Anzeigen</apex:outputLink>                     

                                 <!-- Branche -->     
                                 <br/>          
                                 <apex:outputText value="{!war.WirtschaftszweigWZ08__c}"></apex:outputText>                         

                     </apex:panelGroup>                                                  
                    </apex:panelGrid> 
                   </apex:repeat> 
                  </div>                 
                 </apex:outputpanel> 
                </apex:pageBlockSectionItem>    
               </apex:tab>


    <!-- TAB ACCOUNTS -->
       <apex:tab label="Accounts ({!pot.size})" disabled="{!IF(pot.size = 0,true,false)}" >  
        <apex:pageBlockSectionItem >
         <apex:outputPanel styleClass="container-fluid">
          <div style="height:300px; overflow:auto !important;">     
           <apex:repeat value="{!pot}" var="pote">

                <style type="text/css">
                     .col1 {width:5px; text-align:left;}
                     .col2 {width:400px; text-align:left;}
                </style>

                    <apex:panelGrid columns="2" columnClasses="col1, col2" onmouseover="this.style.backgroundColor='#e2ecf1'" onmouseout="this.style.backgroundColor =''">
                      <apex:image url="{!IF(pote.Nicht_zugewiesene_Leadevents_Counter__c > 0,URLFOR($Resource.mitle),IF(pote.WirtschaftszweigWZ08__c = currentAccount.WirtschaftszweigWZ08__c && pote.Mitarbeiternzahl_final__c = currentAccount.Mitarbeiternzahl_final__c,URLFOR($Resource.perfect_fit), 
                      URLFOR($Resource.ms_marker)))}" styleClass="imageStyle" id="MyImage" onmouseover="ImageOver(this)" onmouseout="ImageNormal(this)"/> 
                        <apex:panelGroup >

                               <!-- Hover for Detail -->   
                                <a id="{!pote.Id}"
                                onmouseover="LookupHoverDetail.getHover('{!pote.Id}', '/{!pote.Id}/m?retURL={!pote.Id}&isAjaxRequest=1').show();"
                                onmouseout="LookupHoverDetail.getHover('{!pote.Id}').hide();"
                                onfocus="LookupHoverDetail.getHover('{!pote.Id}', '/{!pote.Id}/m?retURL={!pote.Id}&isAjaxRequest=1').show();"
                                onblur="LookupHoverDetail.getHover('{!pote.Id}').hide();"
                                href="/{!pote.Id}" target="_blank"> 
                                {!pote.Name}
                                </a> 
                                <br/>

                                <!-- Jump to location and highlight -->
                                 <apex:form >  
                                    <apex:commandLink action="{!findNearbyPotentials}" value="{!pote.ShippingStreet}, {!pote.ShippingPostalCode} {!pote.ShippingCity}" reRender="map">  
                                    <apex:param name="HoverAccount" value="{!pote.id}" assignTo="{!HoverAccount}" />
                                    <apex:param name="center" value="{!pote.MapCurrentAddress__c}" assignTo="{!mapCenter}" />
                                    <apex:param name="zoom" value="13" assignTo="{!zoom}"/>
                                    <apex:param name="HoverLead" value="" assignTo="{!HoverLead}" /> 
                                  </apex:commandLink>  
                                 </apex:form>   

                                <!-- Distanz -->
                                <apex:variable var="url" value="GoogleDistance | https://www.google.com/maps?saddr=+{!currentAccount.Geolocation__c}&daddr=+{!pote.Geolocation__c}" />
                                <apex:outputLink rendered="{!IF(NOT(CONTAINS(selectedField,'Jobads')), true, false)}" value="{!MID(url, FIND('|', url) + 1, LEN(url))}" target="_blank">{!distances[pote.id]}</apex:outputLink>  

                                <!-- Anzahl Anzeigen -->             
                                <apex:outputLink rendered="{!IF(CONTAINS(selectedField,'Jobads'), true, false)}" value="{!pote.indexurl__c}" target="_blank">{!pote.AD_MS_Rel_Anzahl_bez__c} Anzeigen</apex:outputLink> 

                                 <!-- Branche -->   
                                 <br/>           
                                 <apex:outputText value="{!pote.WirtschaftszweigWZ08__c}"></apex:outputText>                     

                        </apex:panelGroup>                                               
                       </apex:panelGrid> 
                      </apex:repeat> 
                     </div> 
                    </apex:outputpanel>                             
                   </apex:pageBlockSectionItem>  
                  </apex:tab>     
                 </apex:tabPanel>      

     </apex:pageblock>

 
I have created a Flow that sends an email using emailalert and afterwards creates an 'emailMessage' record in order to show that email in the activity timeline. This is working so far. But there are 2 things which are not.
  1. 'isTracked' is set to true but the email in the activity timeline stays always at "unopened" - is there something else I have to define? It is working when emails are sent and created the "regular/non-flow" way
  2. 'FromId' is where I would argue needs to be set the id of the user. Unfortunately it throws an error:
Error Occurred: Error occurred attempting to get data type for : RawFieldImpl[tableName: EmailMessage, columnName: FromId]

The result is that in the activity timeline it does not say "You sent the mail", but "jan.tonnet@..." sent the mail.

User-added image

User-added image

User-added image
Hello everyone,

I want to automate the whole process of Opportunity creation so I created a Flow that creates an Opportuntiy with OppLineItems and a Quote with QuoteLineItems. The last step would be to create the PDF for that very quote.

While I am able to "Create Record" with the object "Quote PDF" the pdf itself is blank:

User-added imageUser-added imageI did not chose a "TemplateId" and thought that was the reason. However I find NO way to access the ID of my quote template. I am not even sure this is a real thing because using tools like workbench are not even displaying that field. Seems like this is some CPQ only stuff.

So is this possible using Flow? Creating a complete PDF for a Quote?

Thanks!
Hello everyone,

In my controller I query for leads and accounts to display them in a googlemap and also in a panelGrid:

User-added image
However what I fail to achieve is to display the leads and accounts in the same panelGroup and not 2 single ones
public List<Lead> warehouses  {get; private set;} 
public List<Account> Pot {get; private set;}
So far I have 2 seperate queries. One for 'warehouse' (leads) and one for 'Pot' (accounts) - (here a snippet)
 
warehouses =  [ 
                               SELECT Id,Street,company, Name,
                               FROM Lead
                               WHERE DISTANCE(LocateCity__c, GEOLOCATION(:dlat,:dlon), 'km') < :decimal.valueof(myInput)
                              ORDER BY DISTANCE(LocateCity__c, GEOLOCATION(:dlat,:dlon), 'km')  
                               LIMIT :recordLimit
                      ];
 
pot = [ 
                               SELECT Name,ShippingCity,ShippingPostalCode
                               FROM Account
                               WHERE  DISTANCE(LocateCity__c, GEOLOCATION(:dlat,:dlon), 'km') < :decimal.valueof(myInput) 
                              ORDER BY DISTANCE(LocateCity__c, GEOLOCATION(:dlat,:dlon), 'km')  
                               LIMIT :recordLimit
               ];
Since I do not know any better I created for each an apex:PanelGrid in my visualforce page:

To Display Leads:
<apex:pageBlockSectionItem >
<apex:outputPanel styleClass="container-fluid">
<div style="height:300px; overflow:auto !important;"> 
    
<apex:repeat value="{!warehouses}" var="war">

<apex:panelGrid columns="2" columnClasses="col1, col2"> 
<apex:panelGroup >
                                  
<apex:variable var="url" value="GoogleDistance | https://www.google.com/maps?saddr=+{!currentAccount.Geolocation__c}&daddr=+{!war.Geolocation__c}" />

<apex:outputLink rendered="{!IF(NOT(CONTAINS(selectedField,'Jobads')), true, false)}" value="{!MID(url, FIND('|', url) + 1, LEN(url))}" target="_blank">{!distances[war.id]}</apex:outputLink>  
                   
</apex:panelGroup>                        
</apex:panelGrid>
</apex:repeat> 
</div> 
</apex:outputpanel>    
</apex:pageBlockSectionItem> 
To Display Accounts:
 
<apex:pageBlockSectionItem >
<apex:outputPanel styleClass="container-fluid">
<div style="height:300px; overflow:auto !important;">  
   
<apex:repeat value="{!pot}" var="pote">
                            
<apex:panelGrid columns="2" columnClasses="col1, col2"> 
<apex:panelGroup >
<apex:variable var="url" value="GoogleDistance | https://www.google.com/maps?saddr=+{!currentAccount.Geolocation__c}&daddr=+{!pote.Geolocation__c}" />
<apex:outputLink rendered="{!IF(NOT(CONTAINS(selectedField,'Jobads')), true, false)}" value="{!MID(url, FIND('|', url) + 1, LEN(url))}" target="_blank">{!distances[pote.id]}</apex:outputLink>  
</apex:panelGroup>                              
</apex:panelGrid>                 
</apex:repeat> 
</div> 
</apex:outputpanel>            
</apex:pageBlockSectionItem>

I have read some articles about wrapper classes but struggle to adapt this to my problem.

Can anyone point me in the right direction? To put leads and accounts in the same panelgrid instead of 2 seperate one for each objects?

Thanks!


 

Hello,

is it possible to create and display an apex:mapMarker without reRerender the whole apex:map? I have build a functionality that creates an mapMarker when someone clicks a company name in a table. The goal is to switch to mouseover. However this will be poor user experience if the map reRerenders everytime when someone hovers over the company name.

Can this be done?

Here is my status quo:

User-added image
Visualforce:

        <!-- Add a CUSTOM map marker for the account that was clicked on -->  
           <apex:mapMarker title="{!HoverAcc.Name}" position="{!HoverAcc.GeoLocPosition__c}" icon="{!URLFOR($Resource.ZipFile,'/green.png')}"/>

 
<apex:form > 
                 <apex:commandLink action="{!findNearby}" value="{!war.ShippingStreet}, {!war.ShippingPostalCode} {!war.ShippingCity}" reRender="map">
                        <apex:param name="HoverAccount" value="{!war.id}" assignTo="{!HoverAccount}" />
                     <apex:param name="center" value="{!war.MapCurrentAddress__c}" assignTo="{!mapCenter}" />
                     <apex:param name="zoom" value="13" assignTo="{!zoom}"/>
                    </apex:commandLink> </apex: form>

Apex Class:
 
public Account HoverAcc {get;set;}

public string HoverAccount {get; set;}

    if(HoverAccount != null) { 
            HoverAcc = [SELECT Id,Name,MapCurrentAddress__c,LocateCity__c,LocateCity__Latitude__s,LocateCity__Longitude__s,ShippingState,MetaData_Distance_Customer__c,Blacklisted__c,MetaData_Last_Deal_in_days__c,WZ_Buchstabe__c,WZ_Abteilung__c,WirtschaftszweigWZ08__c, WZ_Code_ebene_2__c,Mitarbeiternzahl_final__c,AD_MS_Rel_Anzahl_bez__c,GeoLocPosition__c,Geolocation__c,Accountinhaber_Text__c,Auftragseingangstyp__c,ShippingStreet,ShippingCity,ShippingPostalCode,URL_zum_CC__c FROM Account WHERE ID =:HoverAccount]; 
       }
        
      
        else {
            HoverAcc = [SELECT Id,Name,MapCurrentAddress__c,LocateCity__c,LocateCity__Latitude__s,LocateCity__Longitude__s,ShippingState,MetaData_Distance_Customer__c,Blacklisted__c,MetaData_Last_Deal_in_days__c,WZ_Buchstabe__c,WZ_Abteilung__c,WirtschaftszweigWZ08__c, WZ_Code_ebene_2__c,Mitarbeiternzahl_final__c,AD_MS_Rel_Anzahl_bez__c,GeoLocPosition__c,Geolocation__c,Accountinhaber_Text__c,Auftragseingangstyp__c,ShippingStreet,ShippingCity,ShippingPostalCode,URL_zum_CC__c FROM Account WHERE ID =:currentAccount.id]; 
       }



Thanks!


  [1]: https://i.stack.imgur.com/iHghB.png
Hello,

I have a Visualforce which displays records inside a googlemap and also as a table. What I want to achieve is the following:

Whenever a user hovers over a record in the table it should get highlighted in the googlemap. I am almost there but the "reRendering/reloading" of the map is where I am stuck right now. This is what I got so far:
               <apex:form>
                    <apex:outputPanel >
                        <apex:actionSupport event="onmouseover" rerender="marker">
                                <apex:param name="image" value="/green.png" assignTo="{!imageName}"/>
                        </apex:actionSupport>
                        <apex:actionSupport event="onmouseout" rerender="marker">
                             <apex:param name="image" value="/ms_star.png" assignTo="{!imageName}"/>
                        </apex:actionSupport>
                          {war.id}
                      </apex:outputPanel>
                  </apex:column>
                  </apex:dataTable>
                 </apex:form>

    <apex:outputPanel id="marker">
       <apex:map ...
          <apex:mapMarker ...
The result for now looks like this (star turns green...):

User-added image
When I hover over the ID it will reRender and displayed like this:

User-added image
The "problem" is that the entire maps reRenders / reloads in the process which is poor user experience. Is there anyway of just rerendering the apex:marker / image? Via some javascript?

Thanks!
Hello,

I have the following code:
<apex:mapMarker position="{!war.GeoLocPosition__c}" title="{!war.Name}" 
                    icon="{!IF(war.AE_letzte_12_Monate__c > 5000,URLFOR($Resource.ms_star),
                            IF(war.AD_MS_Rel_Anzahl_bez__c <= currentAccount.AD_MS_Rel_Anzahl_bez__c && war.WirtschaftszweigWZ08__c = currentAccount.WirtschaftszweigWZ08__c && war.Mitarbeiternzahl_final__c = currentAccount.Mitarbeiternzahl_final__c,URLFOR($Resource.perfect_fit),
                            IF(war.Accountinhaber_Text__c= 'JOB SHOP',URLFOR($Resource.shop),
                    
                    URLFOR($Resource.ms_marker))))}">

What I am trying to fix is that I do not want a "hard copy" image for my icon: URLFOR($Resource.ms_star)

I want to be a variable, sth like: URLFOR($Resource.imageVar) 

Then with a command Link I would assign a specific value (the name of the image inside the static resource) to that variable:
<apex:commandLink action="{!setCenter}" value="{!war.ShippingStreet} ,{!war.ShippingPostalCode} {!war.ShippingCity}" reRender="geomap">
       <apex:param name="image" value="green" assignTo="{!imageName}"/></apex:commandLink>

So far I figured that "imageVar" has to be a variable in my class so I tried:
Public string imageName {get;set;}
And in my visualforce page:
<apex:page standardcontroller="Account" extensions="FindNearbyController" docType="html-5.0" lightningStylesheets="true" action="{!findNearby}"> 
    <apex:variable var="imageVar" value="{!imageName}"/>
What am I am hoping to achieve is that the commandLink passes the value "green" to the variable "imageName" which then gets used as Static Resource for my icon. Obviously there is an png called "green" in my static resource. However I don't get the syntax right for the variable inside the URLFOR. I am receiving: 

*Static Resource named imageVar does not exist. Check spelling.*

 
Hello,

I have a query that returns a list of accounts that are close to my "current" Account and I display them in a visualforce page in the form of a googlemap. Here is the query:
 
warehouses =  [
                               SELECT Id,LocateCity__c,ShippingPostalCode,ShippingState, ShippingCity,Auftragseingang_SM_letzte_24_Monate__c, Name,URL_zum_CC__c,Mitarbeiternzahl_final__c,Auftragseingangstyp__c,AD_MS_Rel_Anzahl_bez__c,Vollst_ndiger_Name__c,ShippingStreet,LocateCity__longitude__s, LocateCity__latitude__s, OwnerId,GeoLocPosition__c,Accountinhaber_Text__c,WirtschaftszweigWZ08__c,WZ_Code_ebene_2__c,AE_letzte_12_Monate__c ,anzeigendaten_de_ID_account__c,indexurl__c
                               FROM Account 
                               WHERE Letzte_gew_Opp_OneSales_in_Tagen__c <= :myTime AND DISTANCE(LocateCity__c, GEOLOCATION(:dlat,:dlon), 'km') < :decimal.valueof(myInput) AND Id != :theaccId 
                      //       ORDER BY DISTANCE(LocateCity__c, GEOLOCATION(:dlat,:dlon), 'km')          
                               LIMIT :recordLimit
                      ];
However I am having some trouble with ORDER BY.
Right now I am not using ORDER BY since it is the reason that not all markers are getting displayed:

here the result with ORDER BY:

User-added image

here the result without ORDER BY:

User-added image

In both cases we talk about 292 records, so the query is fine. It is just about displaying the right amount of mapmarkers. While doing some research I have read it might have sth to do with the fact, that the map gets "re-rendered" before the ORDER BY is done?!

In the end I would like to have the possibility to display the records in an order.

Thanks in advance.
Hello everyone,

I have an apex class that queries for accounts next to the "current" account. Those get displayed in a visualforce page in the form of a googlemap with markers. In addition I present the records in a table for further visibility and transparency.

What I would love to achieve is connect the table with the map just it is in the lightning component -

https://developer.salesforce.com/docs/component-library/bundle/lightning:map

 (hover in the table and highlight in the map or whatever possible)

This is what the visualforce page looks like:

User-added image

Hello everyone,

I have a working Visualforce Page that displays accounts close to my 'current' account in a googlemap. Now I found this aura component:

https://developer.salesforce.com/docs/component-library/bundle/lightning:map/example#lightningcomponentdemo:exampleMapAttributes

While I do not wish to rework everything, I reall like 2 things here that would love to see in my Visualforce page:

1. Hovering over the locations inside the table makes the marker 'jump'
2. The way image, title and addressed are dispayed in one 'block'

Is there any chance of rebuilding this in a visualforce page?

Here is my current version:

User-added image

 

<apex:page standardcontroller="Account" extensions="FindNearbyController" docType="html-5.0" lightningStylesheets="true" action="{!findNearby}"> 

    <apex:pageBlock >
      <apex:pageBlockSection columns="1" id="geomap">
            <!-- Überschrift der VF Page --> 

      <apex:outputText style="font-size:19px;" value="
       
      {!IF(myInput = 'ger' && fcb = true,
       
       '{0} Kunden aus den letzten {1} Tagen in der Branche {2} deutschlandweit gefunden.',    
      
       IF(myInput = 'state'  && fcb = false, 
       
       '{0} Kunden aus den letzten {1} Tagen in {5} gefunden.',
            
        IF(myInput = 'state' && fcb = true,
        
       '{0} Kunden aus den letzten {1} Tagen in der Branche {2} in {5} gefunden.', 
       
       IF(myInput != 'state' && myInput != 'ger' && fcb = true,
       
       '{0} Kunden im {3} km Umkreis aus den letzten {1} Tagen in der Branche {2} gefunden.',
       
       '{0} Kunden im {3} km Umkreis aus den letzten {1} Tagen gefunden.'
       
       ))))}">
       
       <apex:param value="{!warehouses.size}"/>
       <apex:param value="{!myTime}"/>
       <apex:param value="{!currentAccount.WZ_Abteilung__c}"/>
       <apex:param value="{!myInput}"/>
       <apex:param value="{!currentAccount.Name}"/>
       <apex:param value="{!currentAccount.ShippingState}"/>
       
       </apex:outputText> 

        <apex:form style="width:100%">
        <!-- style="width:100%" - sorgt in der Kombination von columns="1" dafür, dass die Seite immer dynamisch 100% der Länge einnimmt  --> 
        
        
          <!-- FILTER 1 (Branche) --> 
        <apex:inputCheckBox id="filter1" disabled="{!currentAccount.WZ_Buchstabe__c = null || myinput = 'ger' }" value="{!fcb}" >
        <apex:actionSupport event="onclick" action="{!findNearby}" rerender="geomap"/>
        </apex:inputCheckBox>
        <apex:outputLabel for="filter1" value="nur aus verwandter Branche ({!currentAccount.WZ_Abteilung__c})" />
              
        <!-- FILTER 2 (Owner) -->     
        <apex:inputCheckBox id="filter2" value="{!fco}" >
        <apex:actionSupport event="onclick" action="{!findNearby}" rerender="geomap"/>
        </apex:inputCheckBox>
        <apex:outputLabel for="filter2" value="nur meine Kunden" />

        
    <!-- Textfeld zur Angabe von km -->
          <apex:inputText value="{!myinput}" style="width:60px" rendered="{!myinput != 'ger' && myinput != 'state' }"/>
          <apex:commandButton value="Umkreis anpassen (in km)" rerender="geomap" action="{!findNearby}" rendered="{!myinput != 'ger' && myinput != 'state' }"/>
                  
         <!-- Button zurück -->  
        <apex:commandButton action="{!findNearby}" value="Zurück zur lokalen Suche" reRender="geomap" rendered="{!myinput = 'ger' || myinput = 'state' }">
         <apex:param assignTo="{!myInput}" name="back" id="back" value="{!currentAccount.MetaData_Distance_Customer__c}"/>
        </apex:commandButton>
                
              <!-- Button deutschlandweit --> 
        <apex:commandButton action="{!findNearby}" value="Deutschlandweit" reRender="geomap" rendered="{!myinput != 'ger'}" disabled="{!IF(fcb = false && fco = true,false,IF(fcb = true && fco = true,false,IF(fcb = true && fco = false,false,true)))}">
         <apex:param assignTo="{!myInput}" name="ger" id="ger" value="ger"/>
        </apex:commandButton>
        
        <!-- Button Bundesland-->  
        <apex:commandButton action="{!findNearby}" value="nur in {!currentAccount.ShippingState}" reRender="geomap" rendered="{!myinput != 'state'}">
         <apex:param assignTo="{!myInput}" name="state" id="state" value="state"/>
        </apex:commandButton>
  
     <!-- Textfeld zur Angabe von Zeitraum -->     
          <apex:inputText value="{!myTime}" style="width:60px"/>
          <apex:commandButton value="Zeitraum anpassen (in Tagen)" rerender="geomap" action="{!findNearby}"/>
      
 
    
        </apex:form> 

            <apex:map width="70%" height="300px" mapType="roadmap" center="{!currentAccount.ShippingStreet},{!currentAccount.ShippingState},{!currentAccount.ShippingCity},{!currentAccount.ShippingPostalCode}" showOnlyActiveInfoWindow="false" >
            
          
             <!-- Add a CUSTOM map marker for the current account -->
             <apex:mapMarker title="{! currentAccount.Name }" position="{!currentAccount.ShippingStreet},{!currentAccount.ShippingState},{!currentAccount.ShippingCity},{!currentAccount.ShippingPostalCode}" icon="{!URLFOR($Resource.location)}"/> 
            
            <!-- Add a CUSTOM map marker for the account list -->
            <!-- Bilder werden als "Static Resource" hochgeladen -->
          
                <apex:repeat value="{!warehouses}" var="war">
                    <apex:mapMarker position="{!war.GeoLocPosition__c}" title="{!war.Name}" 
                    icon="{!IF(war.AE_letzte_12_Monate__c > 5000,URLFOR($Resource.ms_star),
                            IF(war.AD_MS_Rel_Anzahl_bez__c <= currentAccount.AD_MS_Rel_Anzahl_bez__c && war.WirtschaftszweigWZ08__c = currentAccount.WirtschaftszweigWZ08__c && war.Mitarbeiternzahl_final__c = currentAccount.Mitarbeiternzahl_final__c,URLFOR($Resource.perfect_fit),
                            IF(war.Accountinhaber_Text__c= 'JOB SHOP',URLFOR($Resource.shop),
                    
                    URLFOR($Resource.ms_marker))))}" >
            

            <!-- Add Info markers -->
                    
                    <apex:mapInfoWindow >
                                                         
                    <!-- Name + Link -->
                     <apex:outputPanel layout="block" style="font-weight: bold;">
                     <apex:outputLink value="{! '/' + war.Id}">
                    <apex:outputText >{! war.Name }</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                      
                    <!-- Straße -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.ShippingStreet }</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Owner -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.Accountinhaber_Text__c }</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Vertriebskanal -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.Auftragseingangstyp__c}</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Index -->
                     <apex:outputPanel layout="block">
                   <apex:outputLink value="{!war.indexurl__c}">
                    <apex:outputText >{!war.anzeigendaten_de_ID_account__c}</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                        
                    <!-- Branche -->
                     <apex:outputPanel layout="block">
                    <apex:outputText >{! war.WirtschaftszweigWZ08__c}</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Link zum Customer Cockpit -->
                    <apex:outputPanel layout="block">
                   <apex:outputLink value="{!war.URL_zum_CC__c}">
                    <apex:outputText >zum Customer Cockpit</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                                         
                    </apex:mapInfoWindow>

                    </apex:mapMarker>
                </apex:repeat>
            </apex:map>

    <!-- TABLE -->
        <apex:pageBlockTable width="30%" value="{!warehouses}"  var="war" >
              
         <apex:column>  
   <!--  <input type="checkbox" />  -->
   
           
         
         <apex:image url="{!IF(war.AE_letzte_12_Monate__c > 5000,URLFOR($Resource.ms_star),
                            IF(war.AD_MS_Rel_Anzahl_bez__c <= currentAccount.AD_MS_Rel_Anzahl_bez__c && war.WirtschaftszweigWZ08__c = currentAccount.WirtschaftszweigWZ08__c && war.Mitarbeiternzahl_final__c = currentAccount.Mitarbeiternzahl_final__c,URLFOR($Resource.perfect_fit),
                            IF(war.Accountinhaber_Text__c= 'JOB SHOP',URLFOR($Resource.shop),
                    
                    URLFOR($Resource.ms_marker))))}"/>
                    
         <apex:facet name="header">Kunde</apex:facet><apex:outputLink value="/{!war.Id}" target="_blank">{!war.Name}</apex:outputLink>
         
         </apex:column>

      </apex:pageBlockTable>

        </apex:pageBlockSection>

    </apex:pageBlock>
    
    
</apex:page>

Hello folks,

I have a problem with displaying my visualforce page. What I have right now ist this:
User-added image
What I want is this:

User-added image

  • <apex:form style="width:100%"> is fine and should stay this way (displaying the checkboxes and the commandButtons)
  • <apex:map width="70%"> seems to be working as well (displaying the map)
  • <apex:pageBlockTable width="30%"> is what seems to be the problem (displaying a table)

User-added image
Here is my Page:

 

<apex:page standardcontroller="Account" extensions="FindNearbyController" docType="html-5.0" lightningStylesheets="true" action="{!findNearby}"> 

    <apex:pageBlock >
      <apex:pageBlockSection columns="1" id="geomap">
         

      <apex:outputText style="font-size:19px;" value="
       
      {!IF(myInput = 'ger' && fcb = true,
       
       '{0} Kunden aus den letzten {1} Tagen in der Branche {2} deutschlandweit gefunden.',    
      
       IF(myInput = 'state'  && fcb = false, 
       
       '{0} Kunden aus den letzten {1} Tagen in {5} gefunden.',
            
        IF(myInput = 'state' && fcb = true,
        
       '{0} Kunden aus den letzten {1} Tagen in der Branche {2} in {5} gefunden.', 
       
       IF(myInput != 'state' && myInput != 'ger' && fcb = true,
       
       '{0} Kunden im {3} km Umkreis aus den letzten {1} Tagen in der Branche {2} gefunden.',
       
       '{0} Kunden im {3} km Umkreis aus den letzten {1} Tagen gefunden.'
       
       ))))}">
       
       <apex:param value="{!warehouses.size}"/>
       <apex:param value="{!myTime}"/>
       <apex:param value="{!currentAccount.WZ_Abteilung__c}"/>
       <apex:param value="{!myInput}"/>
       <apex:param value="{!currentAccount.Name}"/>
       <apex:param value="{!currentAccount.ShippingState}"/>
       
       </apex:outputText> 

        <apex:form style="width:100%">
        
        
          <!-- FILTER 1 (Branche) --> 
        <apex:inputCheckBox id="filter1" disabled="{!currentAccount.WZ_Buchstabe__c = null || myinput = 'ger' }" value="{!fcb}" >
        <apex:actionSupport event="onclick" action="{!findNearby}" rerender="geomap"/>
        </apex:inputCheckBox>
        <apex:outputLabel for="filter1" value="nur aus verwandter Branche ({!currentAccount.WZ_Abteilung__c})" />
      
        <!-- FILTER 2 (Owner) -->     
        <apex:inputCheckBox id="filter2" value="{!fco}" >
        <apex:actionSupport event="onclick" action="{!findNearby}" rerender="geomap"/>
        </apex:inputCheckBox>
        <apex:outputLabel for="filter2" value="nur meine Kunden" />
  
    <!-- Textfeld zur Angabe von km -->
          <apex:inputText value="{!myinput}" style="width:60px" rendered="{!myinput != 'ger' && myinput != 'state' }"/>
          <apex:commandButton value="Umkreis anpassen (in km)" rerender="geomap" action="{!findNearby}" rendered="{!myinput != 'ger' && myinput != 'state' }"/>
                  
         <!-- Button zurück -->  
        <apex:commandButton action="{!findNearby}" value="Zurück zur lokalen Suche" reRender="geomap" rendered="{!myinput = 'ger' || myinput = 'state' }">
         <apex:param assignTo="{!myInput}" name="back" id="back" value="{!currentAccount.MetaData_Distance_Customer__c}"/>
        </apex:commandButton>
                
              <!-- Button deutschlandweit --> 
        <apex:commandButton action="{!findNearby}" value="Deutschlandweit" reRender="geomap" rendered="{!myinput != 'ger'}" disabled="{!IF(fcb = false && fco = true,false,IF(fcb = true && fco = true,false,IF(fcb = true && fco = false,false,true)))}">
         <apex:param assignTo="{!myInput}" name="ger" id="ger" value="ger"/>
        </apex:commandButton>
        
        <!-- Button Bundesland-->  
        <apex:commandButton action="{!findNearby}" value="nur in {!currentAccount.ShippingState}" reRender="geomap" rendered="{!myinput != 'state'}">
         <apex:param assignTo="{!myInput}" name="state" id="state" value="state"/>
        </apex:commandButton>
  
     <!-- Textfeld zur Angabe von Zeitraum -->     
          <apex:inputText value="{!myTime}" style="width:60px"/>
          <apex:commandButton value="Zeitraum anpassen (in Tagen)" rerender="geomap" action="{!findNearby}"/>
      
 
    
        </apex:form> 

            <apex:map width="70%" height="300px" mapType="roadmap" center="{!currentAccount.ShippingStreet},{!currentAccount.ShippingState},{!currentAccount.ShippingCity},{!currentAccount.ShippingPostalCode}" showOnlyActiveInfoWindow="false" >
            
          
             <!-- Add a CUSTOM map marker for the current account -->
             <apex:mapMarker title="{! currentAccount.Name }" position="{!currentAccount.ShippingStreet},{!currentAccount.ShippingState},{!currentAccount.ShippingCity},{!currentAccount.ShippingPostalCode}" icon="{!URLFOR($Resource.location)}"/> 
            
            <!-- Add a CUSTOM map marker for the account list -->

                <apex:repeat value="{!warehouses}" var="war">
                    <apex:mapMarker position="{!war.GeoLocPosition__c}" title="{!war.Name}" 
                    icon="{!IF(war.AE_letzte_12_Monate__c > 5000,URLFOR($Resource.ms_star),
                            IF(war.AD_MS_Rel_Anzahl_bez__c <= currentAccount.AD_MS_Rel_Anzahl_bez__c && war.WirtschaftszweigWZ08__c = currentAccount.WirtschaftszweigWZ08__c && war.Mitarbeiternzahl_final__c = currentAccount.Mitarbeiternzahl_final__c,URLFOR($Resource.perfect_fit),
                            IF(war.Accountinhaber_Text__c= 'JOB SHOP',URLFOR($Resource.shop),
                    
                    URLFOR($Resource.ms_marker))))}" >
            

            <!-- Add Info markers -->
                    
                    <apex:mapInfoWindow >
                                                         
                    <!-- Name + Link -->
                     <apex:outputPanel layout="block" style="font-weight: bold;">
                     <apex:outputLink value="{! '/' + war.Id}">
                    <apex:outputText >{! war.Name }</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                      
                    <!-- Straße -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.ShippingStreet }</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Owner -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.Accountinhaber_Text__c }</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Vertriebskanal -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.Auftragseingangstyp__c}</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Index -->
                     <apex:outputPanel layout="block">
                   <apex:outputLink value="{!war.indexurl__c}">
                    <apex:outputText >{!war.anzeigendaten_de_ID_account__c}</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                        
                    <!-- Branche -->
                     <apex:outputPanel layout="block">
                    <apex:outputText >{! war.WirtschaftszweigWZ08__c}</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Link zum Customer Cockpit -->
                    <apex:outputPanel layout="block">
                   <apex:outputLink value="{!war.URL_zum_CC__c}">
                    <apex:outputText >zum Customer Cockpit</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                                         
                    </apex:mapInfoWindow>

                    </apex:mapMarker>
                </apex:repeat>
            </apex:map>

    <!-- TABLE -->
        <apex:pageBlockTable width="30%" value="{!warehouses}"  var="war" >
              
         <apex:column > <input type="checkbox" />
         <apex:facet name="header">Kunde</apex:facet><apex:outputLink value="/{!war.Id}" target="_blank">{!war.Name}</apex:outputLink>
         </apex:column>
         
   <!--      <apex:column ><apex:facet name="header">Straße</apex:facet>{!war.ShippingStreet}</apex:column> -->
   <!--      <apex:column ><apex:facet name="header">Stadt</apex:facet>{!war.ShippingCity}</apex:column> -->
   <!--      <apex:column ><apex:facet name="header">Inhaber</apex:facet>{!war.Accountinhaber_Text__c }</apex:column> -->
   <!--      <apex:column ><apex:facet name="header">Index</apex:facet><apex:outputLink value="{!war.indexurl__c}" target="_blank">{!war.anzeigendaten_de_ID_account__c}</apex:outputLink></apex:column> -->
   <!--      <apex:column ><apex:facet name="header">Customer Cockpit</apex:facet><apex:outputLink value="{!war.URL_zum_CC__c}" target="_blank">zum Customer Cockpit</apex:outputLink></apex:column> -->

      </apex:pageBlockTable>

        </apex:pageBlockSection>

    </apex:pageBlock>
    
    
</apex:page>

When I switch from <apex:pageBlockSection columns="1"> to <apex:pageBlockSection columns="2"> it gets all messed up:

User-added image

What do I have to do?

Hello developers,

I have the following checkbox on my visualforce page:
<apex:inputCheckBox id="filter1" value="{!fcb}">
        <apex:actionSupport event="onclick" action="{!findNearby}" rerender="geomap"/>
        </apex:inputCheckBox>
        <apex:outputLabel for="filter1" value="nur aus verwandter Branche ({!currentAccount.WZ_Abteilung__c})" />

So there is no actual field on the account, it just "exists" on the visualforce page.

I am passing the value to my class who runs different queries depending whether this checkbox is true or false:
 

// FILTER 1 (Branche)
     public boolean fcb { get; set; }
     // FILTER 2 (Owner)
     public boolean fco { get; set; }
     // FILTER 3 (perfect fit)
     public boolean fcf { get; set; }
        
     public FindNearbyController (boolean fcb, boolean fco, boolean fcf) {
     this.fcb = fcb;
     this.fco = fco;
     this.fcf = fcf;
     }
...
if (fcb == true && fco == false)  {
       
       warehouses =  [
                               SELECT Id, Name,URL_zum_CC__c,Mitarbeiternzahl_final__c,Auftragseingangstyp__c,AD_MS_Rel_Anzahl_bez__c,Vollst_ndiger_Name__c,ShippingStreet,LocateCity__longitude__s, LocateCity__latitude__s, OwnerId,GeoLocPosition__c,Accountinhaber_Text__c,WirtschaftszweigWZ08__c,WZ_Code_ebene_2__c,AE_letzte_12_Monate__c,anzeigendaten_de_ID_account__c,indexurl__c
                               FROM Account 
                               WHERE Letzte_gew_Opp_OneSales_in_Tagen__c <= :decimal.valueof(myTime) AND DISTANCE(LocateCity__c, GEOLOCATION(:dlat,:dlon), 'km') < :decimal.valueof(myInput) AND Id != :theaccId AND WZ_Code_ebene_2__c= :currentAccount.WZ_Code_ebene_2__c
                               ORDER BY DISTANCE(LocateCity__c, GEOLOCATION(:dlat,:dlon), 'km')  
                               LIMIT :recordLimit
                      ];

What I am trying to achieve is to set {!fcb} by default to true, so that the 1st query runs with pageload. I already tried "selected = 'true'". While the checkbox gets actually checked, the query does not get fired. Only when I "re-trigger" my "action" it will query. 

I would conclude that 'selecetd = true' is only for "visual" and there is no actual value getting passed to the controller?! Or is event="onclick" the problem?

How can I make this work? That the query runs on pageload with {!fcb} set to true.

Thanks in Advance!

 

Hello developers,

I have a visualforce page that includes a map with infowindows. Hovering over the marker I display (as for now) only the title.

What I want to achieve is to display also some more fields. To make it readable I want to use linebreaks (or sth else?). This is where I'm stuck.

<apex:mapMarker title="{!war.Name} {!war.ShippingStreet}">

User-added imageI want title and street to be displayed like this:

Title
Street
...

Is this possible? Every´thing I try gets display as plain text.

Thanks in Advance

Hello developers,

I have created a custom metadata type called 'Geolocation__mdt' with 2 custom fields: Distance__c and Limit__c

What I am (unsuccessfully) trying to achieve is to use the values stored in Distance__c and Limit__c as parameters for my SOQL query:
String queryString =
           'SELECT Id, Name,AD_JobAds_Anz__c,Vollst_ndiger_Name__c,ShippingStreet,LocateCity__longitude__s, LocateCity__latitude__s  ' +
           'FROM Account ' +
           'WHERE DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') <  3 and Kundenstatus_Direktvertrieb__c = \'Bestandskunde\' and Id != :theaccId ' +
           'ORDER BY DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') ' +
'LIMIT 50';
But instead of: 
WHERE DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') <  3
I want to use:
WHERE DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') <  Geolocation__mdt.Distance__c
and instead of :
'LIMIT 50';
I want to use 
'LIMIT = Geolocation__mdt.Limit__c';

The main goal is to stay flexible since the values may change over the course of time and I don't want to touch my code every time.
 

Thanks!


 

Hello developers,

I am tackling a problem which is probably quite straight forward but I can't figure it out:

I have extend the code from https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_maps_example.htm to fit my needs.

In there I have 
public List<Map<String,Double>> locations { get; private set; }
which later gets reffered to here:
// SOQL query to get the nearest warehouses

        String queryString =
           'SELECT Id, Name,AD_JobAds_Anz__c,Vollst_ndiger_Name__c,ShippingStreet,LocateCity__longitude__s, LocateCity__latitude__s  ' +
           'FROM Account ' +
           'WHERE DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') <  3 and Kundenstatus_Direktvertrieb__c = \'Bestandskunde\' and Id != :theaccId ' +
           'ORDER BY DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') '; 
        
        List <Account> warehouses = database.Query(queryString);
                 
        if(0 < warehouses.size()) {
            // Convert to locations that can be mapped
            locations = new List<Map<String,Double>>();
            for (Account wh : warehouses) {
                locations.add(
                    new Map<String,Double>{
                        'latitude' => wh.LocateCity__latitude__s, 
                        'longitude' => wh.LocateCity__longitude__s

Now I am trying to access the fields/values of the account but since it is a List of Maps, this is not working. I have to tranform it to a list that contains the Accounts/sObject?? Then I can access its fields?

Maybe some can share some insights.
Thanks!


 

Hello developers,

I found the following example code on https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_maps_example.htm

After some minor changes to fit my needs, I got his running to show me the "nearest" customers to the account I am currently on - displayed in a visualforce page with customized markers and a Info window. 

The info window however is causing me headaches since I don't know how to store and access the values of every marker (account).

When I understand the code correctly the SOQL Query is called "querystring" and gives back accounts based on the criteria. These accounts are then stored in a List called "warehouses"

What I need now is to store the values of a couple of account fields from those accounts that got added to the list. For example Name and Owner. 

I want to reuse these as variables in thr visualforce page. Being part of the original code, this already works for: 

locations = new List<Map<String,Double>>()
This is being accessed in the visualforce page by using 
<apex:repeat value="{!locations}" var="pos">

which allows me to show the geolocations of every marker I click

<apex:outputPanel layout="block">
<apex:outputText >{!pos}</apex:outputText>
</apex:outputPanel>
 

User-added image

As being said I would need that not only for 'locations' but as well for a couple of other fields from the account. The goal is to see the corresponding accountname, owner and so on for the clicked marker.

Here is the complete APEX Code:
 

/* https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_maps_example.htm */

   
     public class FindNearbyController {
     
     public List<Map<String,Double>> locations { get; private set; }
     
     public Account currentAccount {get;set;}
     
     public Geolocation__mdt GeoConfig { get; set; }
  
     public FindNearbyController(ApexPages.StandardController stdController) {
        currentAccount  = [SELECT ID,Name, Geolocation__c,Accountinhaber_Text__c,Auftragseingangstyp_picklist__c,ShippingStreet,URL_zum_CC__c FROM Account WHERE ID =: stdController.getID()];

    }


 
      public String currentPosition { 
        get {
            if (String.isBlank(currentPosition)) {
                currentPosition = currentAccount.Geolocation__c; 

            }
            return currentPosition;
        }
        set; 
    }

    
    public Boolean resultsAvailable {
        get {
            if(locations == Null) {
                return false;
            }
            return true;
        }
    }    

    
    public PageReference findNearby() {
        String lat, lon;

        // FRAGILE: You'll want a better lat/long parsing routine
        // Format: "<latitude>,<longitude>" (must have comma, but only one comma)
        List<String> latlon = currentPosition.split(',');
        lat = latlon[0].trim();
        lon = latlon[1].trim();

        // SOQL query to get the nearest warehouses
        String queryString =
           'SELECT Id, Name,ShippingStreet,LocateCity__longitude__s, LocateCity__latitude__s  ' +
           'FROM Account ' +
           'WHERE DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') <  3 and Kundenstatus_Direktvertrieb__c = \'Bestandskunde\' ' +
           'ORDER BY DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') '; //+ 
        // 'LIMIT 50'; (semikolon muss dann in der zeile oben weg)

        // Run the query
        List <Account> warehouses = database.Query(queryString);
        
        if(0 < warehouses.size()) {
            // Convert to locations that can be mapped
            locations = new List<Map<String,Double>>();
            for (Account wh : warehouses) {
                locations.add(
                    new Map<String,Double>{
                        'latitude' => wh.LocateCity__latitude__s, 
                        'longitude' => wh.LocateCity__longitude__s
                        
                        
                    }
                );
            }
        }
        else {
            System.debug('No results. Query: ' + queryString);
        }
                
        return null;
    }
}
Here is the visualforce page:
 
<apex:page standardcontroller="Account" extensions="FindNearbyController" docType="html-5.0" >

    <apex:pageBlock >
        <!-- Form field to send currentPosition in request. You can make it
             an <apex:inputHidden> field to hide it. -->
        <apex:pageBlockSection >
            <apex:form >
                <apex:outputLabel for="currentPosition">Bestandskunden in der Nähe</apex:outputLabel> 
                <apex:input size="30" 
                     html-placeholder="Attempting to obtain your position..."
                     id="currentPosition" styleClass="currentPosition" 
                     value="{!currentPosition}" />
                <apex:commandButton action="{!findNearby}" value="Go!"/>
            </apex:form>
        </apex:pageBlockSection>
        
        <!-- Map of the results -->
        <apex:pageBlockSection rendered="{!resultsAvailable}" title="Locations" columns="1">
        

            <apex:map width="100%" height="350px" mapType="roadmap" center="{!currentAccount.ShippingStreet}" showOnlyActiveInfoWindow="false" >
                <apex:repeat value="{!locations}" var="pos">
                    <apex:mapMarker position="{!pos}" icon="{!URLFOR($Resource.ms_marker)}" title="{!currentAccount.Name}">
                    
                    <apex:mapInfoWindow >
                    
                     <!-- Test -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{!pos}</apex:outputText>
                    </apex:outputPanel>
                    
                    
                    <!-- Name + Link -->
                     <apex:outputPanel layout="block" style="font-weight: bold;">
                     <apex:outputLink value="{! '/' + currentAccount.Id}">
                    <apex:outputText >{! currentAccount.Name }</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                    
                    <!-- Straße -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! currentAccount.ShippingStreet }</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Owner -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! currentAccount.Accountinhaber_Text__c }</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Vertriebskanal -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! currentAccount.Auftragseingangstyp_picklist__c}</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Link zum Customer Cockpit -->
                    <apex:outputPanel layout="block">
                   <apex:outputLink value="{!'/' + currentAccount.URL_zum_CC__c}">
                    <apex:outputText >zum Customer Cockpit</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                    
                    
                    </apex:mapInfoWindow>

                    </apex:mapMarker>

                </apex:repeat>
            </apex:map>
 
        </apex:pageBlockSection>

    </apex:pageBlock>
</apex:page>

Hello everyone,

I guess this is as standard as it gets but I still struggle as newby in apex classes and triggers.

I have an apex class that - as for now - is being invoked by a process builder. But in regards of performance I want to switch to an apex trigger.

Here is the class:

Public class generateQuotePdfDocumentByTrigger{

//https://github.com/Rakeshistom/Auto-Generates-Quote-PDF

public static void QuoteCreate (List<Id> quoteIds) {

    //Initialize the quote url
    String quoteUrl = '/quote/quoteTemplateDataViewer.apexp?';
    
    //Get the Quote Template Id from Custom Settings
    String quoteTemplateId = Label.QuoteTemplateId;
    
    //List variable to get all the Quote Documents
    List<QuoteDocument> lstQuoteDoc = new List<QuoteDocument>();
    
    if(!quoteIds.isEmpty() && quoteIds.size() > 0) {
        
        for(Id quoteId :quoteIds) {
            //Construct the quote URL to generate PDF
            quoteUrl += 'id=' + quoteId;
            quoteUrl += '&headerHeight=197&footerHeight=80';
            quoteUrl += '&summlid=' + quoteTemplateId;
            
            //call the quote url
            PageReference pageRef = new PageReference(quoteUrl);
            
            //get the quotePdf
            Blob quoteBlob;
            
            if(Test.isRunningTest()) {
                quoteBlob = Blob.valueOf('Generate Pdf');
            } else {
                quoteBlob = pageRef.getContentAsPDF();
            }
            
            //initialze the QuoteDocument to hold the quote pdf for insertion
            QuoteDocument quoteDoc = new QuoteDocument();
            quoteDoc.Document = quoteBlob;
            quoteDoc.QuoteId = quoteId;
            lstQuoteDoc.add(quoteDoc);
        }
    }
    
    if(!lstQuoteDoc.isEmpty() && lstQuoteDoc.size() > 0) {
        Database.insert(lstQuoteDoc);
    }

}
}
What I like the trigger to do is the following:

After "Create_PDF__c" is set to "true" - invoke the apex class.

This is what I got so for but yeah...

Error: Compile Error: Method does not exist or incorrect signature: void generateQuotePdfDocumentByTrigger() from the type CreatePDFQuote_JTo at line 7 column 9
trigger CreatePDFQuote_JTo on Quote (after update) 

{
    for(Quote currentQuote : Trigger.New)
    {
        if(currentQuote.Create_PDF__c == true ) {
        generateQuotePdfDocumentByTrigger();
        }
    }
    
  
}

Thanks in Advance!
Hello there,

I have a bit of trouble correctly displaying my data:

my apex class:
 
public class QuoteList {

public Opportunity currentOpp {get;set;}
public List<Quote> quotes  {get;set;} 

 public QuoteList(ApexPages.StandardController stdController) {
     currentOpp  = [SELECT Id FROM Opportunity WHERE ID =: stdController.getID()];
     }
    
public PageReference getPdfs() {         

quotes = [SELECT Id,Name,(SELECT Id,CreatedDate,Name,ContentVersionDocumentId,QuoteId FROM QuoteDocuments)FROM Quote WHERE OpportunityId = :currentOpp.id];


return null;
}
}

my visualforce page:
 
<apex:page standardcontroller="Opportunity" extensions="QuoteList" lightningStylesheets="true" action="{!getPdfs}">  
       
    
  <apex:form >
<apex:pageBlock >  
    <apex:repeat value="{!quotes}" var="quote">
    
      <apex:pageBlockTable value="{!quote.QuoteDocuments}" var="pdf" >

        <apex:column headerValue="Name">
        <apex:outputlink value="https://meinestadt--syncs.my.salesforce.com/servlet/servlet.FileDownload?file={!pdf.id}" target="_blank">{!pdf.Name}</apex:outputlink>
       </apex:column>
       
        <apex:column value="{!pdf.CreatedDate}"/>
       
     </apex:pageBlockTable>
  
    </apex:repeat>

 </apex:pageBlock>
 </apex:form>
</apex:page>

the result:

User-added image
I am doing almost identical code (class & vf) when I display all contacts from the account related to a task - this works just fine:

User-added image
Where did I go wrong?

Thanks!
Hello guys,

I am trying to automate the generation of quote pdfs. I have found a really nice blog entry on that topic here: https://automationchampion.com/2020/06/23/getting-started-with-process-builder-part-97-now-generating-a-quote-pdf-is-a-breeze-learn-how/?fbclid=IwAR0QHkSOjk2TG9hzdthNAbJ88hQjKjGX8FuV_UicCcnT_N-sfp5PJBicXVo

Everything works fine except for the fact that pdf just turns out completely blank.

Here the code from github:
Public class generateQuotePdfDocument{
    @InvocableMethod   

    //https://github.com/Rakeshistom/Auto-Generates-Quote-PDF

    public static void LeadAssign(List<Id> quoteIds)  
    { 
    //Initialize the quote url
    String quoteUrl = '/quote/quoteTemplateDataViewer.apexp?';
    
    //Get the Quote Template Id from Custom Settings
    String quoteTemplateId = Label.QuoteTemplateId;
    
    //List variable to get all the Quote Documents
    List<QuoteDocument> lstQuoteDoc = new List<QuoteDocument>();
    
    if(!quoteIds.isEmpty() && quoteIds.size() > 0) {
        
        for(Id quoteId :quoteIds) {
            //Construct the quote URL to generate PDF
            quoteUrl += 'id=' + quoteId;
            quoteUrl += '&headerHeight=197&footerHeight=10';
            quoteUrl += '&summlid=' + quoteTemplateId;
            
            //call the quote url
            PageReference pageRef = new PageReference(quoteUrl);
            
            //get the quotePdf
            Blob quoteBlob;
            
            if(Test.isRunningTest()) {
                quoteBlob = Blob.valueOf('Generate Pdf');
            } else {
                quoteBlob = pageRef.getContentAsPDF();
            }
            
            //initialze the QuoteDocument to hold the quote pdf for insertion
            QuoteDocument quoteDoc = new QuoteDocument();
            quoteDoc.Document = quoteBlob;
            quoteDoc.QuoteId = quoteId;
            lstQuoteDoc.add(quoteDoc);
        }
    }
    
    if(!lstQuoteDoc.isEmpty() && lstQuoteDoc.size() > 0) {
        Database.insert(lstQuoteDoc);
    }
    }
    }
Any thoughts what might be the problem?
Hello guys,

I have the following feature request:

On the opportunity level I want to see all pdfs from all quotes from that very opportunity. So I think (hopefully) this is something Apex can do for me. 

As I am not much of a developer I was thinking I need something like:
ListOfPDFs = [SELECT Id, ... FROM Quote (SELECT Id,... FROM QuotePDF) WHERE Opportunity.Id = currentOpportunity
In the end I want to display it as a simple table in visualforce. 

Any advice is appreciated

Thanks a lot!
Hello,

I have a Visualforce which displays records inside a googlemap and also as a table. What I want to achieve is the following:

Whenever a user hovers over a record in the table it should get highlighted in the googlemap. I am almost there but the "reRendering/reloading" of the map is where I am stuck right now. This is what I got so far:
               <apex:form>
                    <apex:outputPanel >
                        <apex:actionSupport event="onmouseover" rerender="marker">
                                <apex:param name="image" value="/green.png" assignTo="{!imageName}"/>
                        </apex:actionSupport>
                        <apex:actionSupport event="onmouseout" rerender="marker">
                             <apex:param name="image" value="/ms_star.png" assignTo="{!imageName}"/>
                        </apex:actionSupport>
                          {war.id}
                      </apex:outputPanel>
                  </apex:column>
                  </apex:dataTable>
                 </apex:form>

    <apex:outputPanel id="marker">
       <apex:map ...
          <apex:mapMarker ...
The result for now looks like this (star turns green...):

User-added image
When I hover over the ID it will reRender and displayed like this:

User-added image
The "problem" is that the entire maps reRenders / reloads in the process which is poor user experience. Is there anyway of just rerendering the apex:marker / image? Via some javascript?

Thanks!
Hello,

I have the following code:
<apex:mapMarker position="{!war.GeoLocPosition__c}" title="{!war.Name}" 
                    icon="{!IF(war.AE_letzte_12_Monate__c > 5000,URLFOR($Resource.ms_star),
                            IF(war.AD_MS_Rel_Anzahl_bez__c <= currentAccount.AD_MS_Rel_Anzahl_bez__c && war.WirtschaftszweigWZ08__c = currentAccount.WirtschaftszweigWZ08__c && war.Mitarbeiternzahl_final__c = currentAccount.Mitarbeiternzahl_final__c,URLFOR($Resource.perfect_fit),
                            IF(war.Accountinhaber_Text__c= 'JOB SHOP',URLFOR($Resource.shop),
                    
                    URLFOR($Resource.ms_marker))))}">

What I am trying to fix is that I do not want a "hard copy" image for my icon: URLFOR($Resource.ms_star)

I want to be a variable, sth like: URLFOR($Resource.imageVar) 

Then with a command Link I would assign a specific value (the name of the image inside the static resource) to that variable:
<apex:commandLink action="{!setCenter}" value="{!war.ShippingStreet} ,{!war.ShippingPostalCode} {!war.ShippingCity}" reRender="geomap">
       <apex:param name="image" value="green" assignTo="{!imageName}"/></apex:commandLink>

So far I figured that "imageVar" has to be a variable in my class so I tried:
Public string imageName {get;set;}
And in my visualforce page:
<apex:page standardcontroller="Account" extensions="FindNearbyController" docType="html-5.0" lightningStylesheets="true" action="{!findNearby}"> 
    <apex:variable var="imageVar" value="{!imageName}"/>
What am I am hoping to achieve is that the commandLink passes the value "green" to the variable "imageName" which then gets used as Static Resource for my icon. Obviously there is an png called "green" in my static resource. However I don't get the syntax right for the variable inside the URLFOR. I am receiving: 

*Static Resource named imageVar does not exist. Check spelling.*

 

Hello everyone,

I have a working Visualforce Page that displays accounts close to my 'current' account in a googlemap. Now I found this aura component:

https://developer.salesforce.com/docs/component-library/bundle/lightning:map/example#lightningcomponentdemo:exampleMapAttributes

While I do not wish to rework everything, I reall like 2 things here that would love to see in my Visualforce page:

1. Hovering over the locations inside the table makes the marker 'jump'
2. The way image, title and addressed are dispayed in one 'block'

Is there any chance of rebuilding this in a visualforce page?

Here is my current version:

User-added image

 

<apex:page standardcontroller="Account" extensions="FindNearbyController" docType="html-5.0" lightningStylesheets="true" action="{!findNearby}"> 

    <apex:pageBlock >
      <apex:pageBlockSection columns="1" id="geomap">
            <!-- Überschrift der VF Page --> 

      <apex:outputText style="font-size:19px;" value="
       
      {!IF(myInput = 'ger' && fcb = true,
       
       '{0} Kunden aus den letzten {1} Tagen in der Branche {2} deutschlandweit gefunden.',    
      
       IF(myInput = 'state'  && fcb = false, 
       
       '{0} Kunden aus den letzten {1} Tagen in {5} gefunden.',
            
        IF(myInput = 'state' && fcb = true,
        
       '{0} Kunden aus den letzten {1} Tagen in der Branche {2} in {5} gefunden.', 
       
       IF(myInput != 'state' && myInput != 'ger' && fcb = true,
       
       '{0} Kunden im {3} km Umkreis aus den letzten {1} Tagen in der Branche {2} gefunden.',
       
       '{0} Kunden im {3} km Umkreis aus den letzten {1} Tagen gefunden.'
       
       ))))}">
       
       <apex:param value="{!warehouses.size}"/>
       <apex:param value="{!myTime}"/>
       <apex:param value="{!currentAccount.WZ_Abteilung__c}"/>
       <apex:param value="{!myInput}"/>
       <apex:param value="{!currentAccount.Name}"/>
       <apex:param value="{!currentAccount.ShippingState}"/>
       
       </apex:outputText> 

        <apex:form style="width:100%">
        <!-- style="width:100%" - sorgt in der Kombination von columns="1" dafür, dass die Seite immer dynamisch 100% der Länge einnimmt  --> 
        
        
          <!-- FILTER 1 (Branche) --> 
        <apex:inputCheckBox id="filter1" disabled="{!currentAccount.WZ_Buchstabe__c = null || myinput = 'ger' }" value="{!fcb}" >
        <apex:actionSupport event="onclick" action="{!findNearby}" rerender="geomap"/>
        </apex:inputCheckBox>
        <apex:outputLabel for="filter1" value="nur aus verwandter Branche ({!currentAccount.WZ_Abteilung__c})" />
              
        <!-- FILTER 2 (Owner) -->     
        <apex:inputCheckBox id="filter2" value="{!fco}" >
        <apex:actionSupport event="onclick" action="{!findNearby}" rerender="geomap"/>
        </apex:inputCheckBox>
        <apex:outputLabel for="filter2" value="nur meine Kunden" />

        
    <!-- Textfeld zur Angabe von km -->
          <apex:inputText value="{!myinput}" style="width:60px" rendered="{!myinput != 'ger' && myinput != 'state' }"/>
          <apex:commandButton value="Umkreis anpassen (in km)" rerender="geomap" action="{!findNearby}" rendered="{!myinput != 'ger' && myinput != 'state' }"/>
                  
         <!-- Button zurück -->  
        <apex:commandButton action="{!findNearby}" value="Zurück zur lokalen Suche" reRender="geomap" rendered="{!myinput = 'ger' || myinput = 'state' }">
         <apex:param assignTo="{!myInput}" name="back" id="back" value="{!currentAccount.MetaData_Distance_Customer__c}"/>
        </apex:commandButton>
                
              <!-- Button deutschlandweit --> 
        <apex:commandButton action="{!findNearby}" value="Deutschlandweit" reRender="geomap" rendered="{!myinput != 'ger'}" disabled="{!IF(fcb = false && fco = true,false,IF(fcb = true && fco = true,false,IF(fcb = true && fco = false,false,true)))}">
         <apex:param assignTo="{!myInput}" name="ger" id="ger" value="ger"/>
        </apex:commandButton>
        
        <!-- Button Bundesland-->  
        <apex:commandButton action="{!findNearby}" value="nur in {!currentAccount.ShippingState}" reRender="geomap" rendered="{!myinput != 'state'}">
         <apex:param assignTo="{!myInput}" name="state" id="state" value="state"/>
        </apex:commandButton>
  
     <!-- Textfeld zur Angabe von Zeitraum -->     
          <apex:inputText value="{!myTime}" style="width:60px"/>
          <apex:commandButton value="Zeitraum anpassen (in Tagen)" rerender="geomap" action="{!findNearby}"/>
      
 
    
        </apex:form> 

            <apex:map width="70%" height="300px" mapType="roadmap" center="{!currentAccount.ShippingStreet},{!currentAccount.ShippingState},{!currentAccount.ShippingCity},{!currentAccount.ShippingPostalCode}" showOnlyActiveInfoWindow="false" >
            
          
             <!-- Add a CUSTOM map marker for the current account -->
             <apex:mapMarker title="{! currentAccount.Name }" position="{!currentAccount.ShippingStreet},{!currentAccount.ShippingState},{!currentAccount.ShippingCity},{!currentAccount.ShippingPostalCode}" icon="{!URLFOR($Resource.location)}"/> 
            
            <!-- Add a CUSTOM map marker for the account list -->
            <!-- Bilder werden als "Static Resource" hochgeladen -->
          
                <apex:repeat value="{!warehouses}" var="war">
                    <apex:mapMarker position="{!war.GeoLocPosition__c}" title="{!war.Name}" 
                    icon="{!IF(war.AE_letzte_12_Monate__c > 5000,URLFOR($Resource.ms_star),
                            IF(war.AD_MS_Rel_Anzahl_bez__c <= currentAccount.AD_MS_Rel_Anzahl_bez__c && war.WirtschaftszweigWZ08__c = currentAccount.WirtschaftszweigWZ08__c && war.Mitarbeiternzahl_final__c = currentAccount.Mitarbeiternzahl_final__c,URLFOR($Resource.perfect_fit),
                            IF(war.Accountinhaber_Text__c= 'JOB SHOP',URLFOR($Resource.shop),
                    
                    URLFOR($Resource.ms_marker))))}" >
            

            <!-- Add Info markers -->
                    
                    <apex:mapInfoWindow >
                                                         
                    <!-- Name + Link -->
                     <apex:outputPanel layout="block" style="font-weight: bold;">
                     <apex:outputLink value="{! '/' + war.Id}">
                    <apex:outputText >{! war.Name }</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                      
                    <!-- Straße -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.ShippingStreet }</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Owner -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.Accountinhaber_Text__c }</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Vertriebskanal -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.Auftragseingangstyp__c}</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Index -->
                     <apex:outputPanel layout="block">
                   <apex:outputLink value="{!war.indexurl__c}">
                    <apex:outputText >{!war.anzeigendaten_de_ID_account__c}</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                        
                    <!-- Branche -->
                     <apex:outputPanel layout="block">
                    <apex:outputText >{! war.WirtschaftszweigWZ08__c}</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Link zum Customer Cockpit -->
                    <apex:outputPanel layout="block">
                   <apex:outputLink value="{!war.URL_zum_CC__c}">
                    <apex:outputText >zum Customer Cockpit</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                                         
                    </apex:mapInfoWindow>

                    </apex:mapMarker>
                </apex:repeat>
            </apex:map>

    <!-- TABLE -->
        <apex:pageBlockTable width="30%" value="{!warehouses}"  var="war" >
              
         <apex:column>  
   <!--  <input type="checkbox" />  -->
   
           
         
         <apex:image url="{!IF(war.AE_letzte_12_Monate__c > 5000,URLFOR($Resource.ms_star),
                            IF(war.AD_MS_Rel_Anzahl_bez__c <= currentAccount.AD_MS_Rel_Anzahl_bez__c && war.WirtschaftszweigWZ08__c = currentAccount.WirtschaftszweigWZ08__c && war.Mitarbeiternzahl_final__c = currentAccount.Mitarbeiternzahl_final__c,URLFOR($Resource.perfect_fit),
                            IF(war.Accountinhaber_Text__c= 'JOB SHOP',URLFOR($Resource.shop),
                    
                    URLFOR($Resource.ms_marker))))}"/>
                    
         <apex:facet name="header">Kunde</apex:facet><apex:outputLink value="/{!war.Id}" target="_blank">{!war.Name}</apex:outputLink>
         
         </apex:column>

      </apex:pageBlockTable>

        </apex:pageBlockSection>

    </apex:pageBlock>
    
    
</apex:page>

Hello folks,

I have a problem with displaying my visualforce page. What I have right now ist this:
User-added image
What I want is this:

User-added image

  • <apex:form style="width:100%"> is fine and should stay this way (displaying the checkboxes and the commandButtons)
  • <apex:map width="70%"> seems to be working as well (displaying the map)
  • <apex:pageBlockTable width="30%"> is what seems to be the problem (displaying a table)

User-added image
Here is my Page:

 

<apex:page standardcontroller="Account" extensions="FindNearbyController" docType="html-5.0" lightningStylesheets="true" action="{!findNearby}"> 

    <apex:pageBlock >
      <apex:pageBlockSection columns="1" id="geomap">
         

      <apex:outputText style="font-size:19px;" value="
       
      {!IF(myInput = 'ger' && fcb = true,
       
       '{0} Kunden aus den letzten {1} Tagen in der Branche {2} deutschlandweit gefunden.',    
      
       IF(myInput = 'state'  && fcb = false, 
       
       '{0} Kunden aus den letzten {1} Tagen in {5} gefunden.',
            
        IF(myInput = 'state' && fcb = true,
        
       '{0} Kunden aus den letzten {1} Tagen in der Branche {2} in {5} gefunden.', 
       
       IF(myInput != 'state' && myInput != 'ger' && fcb = true,
       
       '{0} Kunden im {3} km Umkreis aus den letzten {1} Tagen in der Branche {2} gefunden.',
       
       '{0} Kunden im {3} km Umkreis aus den letzten {1} Tagen gefunden.'
       
       ))))}">
       
       <apex:param value="{!warehouses.size}"/>
       <apex:param value="{!myTime}"/>
       <apex:param value="{!currentAccount.WZ_Abteilung__c}"/>
       <apex:param value="{!myInput}"/>
       <apex:param value="{!currentAccount.Name}"/>
       <apex:param value="{!currentAccount.ShippingState}"/>
       
       </apex:outputText> 

        <apex:form style="width:100%">
        
        
          <!-- FILTER 1 (Branche) --> 
        <apex:inputCheckBox id="filter1" disabled="{!currentAccount.WZ_Buchstabe__c = null || myinput = 'ger' }" value="{!fcb}" >
        <apex:actionSupport event="onclick" action="{!findNearby}" rerender="geomap"/>
        </apex:inputCheckBox>
        <apex:outputLabel for="filter1" value="nur aus verwandter Branche ({!currentAccount.WZ_Abteilung__c})" />
      
        <!-- FILTER 2 (Owner) -->     
        <apex:inputCheckBox id="filter2" value="{!fco}" >
        <apex:actionSupport event="onclick" action="{!findNearby}" rerender="geomap"/>
        </apex:inputCheckBox>
        <apex:outputLabel for="filter2" value="nur meine Kunden" />
  
    <!-- Textfeld zur Angabe von km -->
          <apex:inputText value="{!myinput}" style="width:60px" rendered="{!myinput != 'ger' && myinput != 'state' }"/>
          <apex:commandButton value="Umkreis anpassen (in km)" rerender="geomap" action="{!findNearby}" rendered="{!myinput != 'ger' && myinput != 'state' }"/>
                  
         <!-- Button zurück -->  
        <apex:commandButton action="{!findNearby}" value="Zurück zur lokalen Suche" reRender="geomap" rendered="{!myinput = 'ger' || myinput = 'state' }">
         <apex:param assignTo="{!myInput}" name="back" id="back" value="{!currentAccount.MetaData_Distance_Customer__c}"/>
        </apex:commandButton>
                
              <!-- Button deutschlandweit --> 
        <apex:commandButton action="{!findNearby}" value="Deutschlandweit" reRender="geomap" rendered="{!myinput != 'ger'}" disabled="{!IF(fcb = false && fco = true,false,IF(fcb = true && fco = true,false,IF(fcb = true && fco = false,false,true)))}">
         <apex:param assignTo="{!myInput}" name="ger" id="ger" value="ger"/>
        </apex:commandButton>
        
        <!-- Button Bundesland-->  
        <apex:commandButton action="{!findNearby}" value="nur in {!currentAccount.ShippingState}" reRender="geomap" rendered="{!myinput != 'state'}">
         <apex:param assignTo="{!myInput}" name="state" id="state" value="state"/>
        </apex:commandButton>
  
     <!-- Textfeld zur Angabe von Zeitraum -->     
          <apex:inputText value="{!myTime}" style="width:60px"/>
          <apex:commandButton value="Zeitraum anpassen (in Tagen)" rerender="geomap" action="{!findNearby}"/>
      
 
    
        </apex:form> 

            <apex:map width="70%" height="300px" mapType="roadmap" center="{!currentAccount.ShippingStreet},{!currentAccount.ShippingState},{!currentAccount.ShippingCity},{!currentAccount.ShippingPostalCode}" showOnlyActiveInfoWindow="false" >
            
          
             <!-- Add a CUSTOM map marker for the current account -->
             <apex:mapMarker title="{! currentAccount.Name }" position="{!currentAccount.ShippingStreet},{!currentAccount.ShippingState},{!currentAccount.ShippingCity},{!currentAccount.ShippingPostalCode}" icon="{!URLFOR($Resource.location)}"/> 
            
            <!-- Add a CUSTOM map marker for the account list -->

                <apex:repeat value="{!warehouses}" var="war">
                    <apex:mapMarker position="{!war.GeoLocPosition__c}" title="{!war.Name}" 
                    icon="{!IF(war.AE_letzte_12_Monate__c > 5000,URLFOR($Resource.ms_star),
                            IF(war.AD_MS_Rel_Anzahl_bez__c <= currentAccount.AD_MS_Rel_Anzahl_bez__c && war.WirtschaftszweigWZ08__c = currentAccount.WirtschaftszweigWZ08__c && war.Mitarbeiternzahl_final__c = currentAccount.Mitarbeiternzahl_final__c,URLFOR($Resource.perfect_fit),
                            IF(war.Accountinhaber_Text__c= 'JOB SHOP',URLFOR($Resource.shop),
                    
                    URLFOR($Resource.ms_marker))))}" >
            

            <!-- Add Info markers -->
                    
                    <apex:mapInfoWindow >
                                                         
                    <!-- Name + Link -->
                     <apex:outputPanel layout="block" style="font-weight: bold;">
                     <apex:outputLink value="{! '/' + war.Id}">
                    <apex:outputText >{! war.Name }</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                      
                    <!-- Straße -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.ShippingStreet }</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Owner -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.Accountinhaber_Text__c }</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Vertriebskanal -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.Auftragseingangstyp__c}</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Index -->
                     <apex:outputPanel layout="block">
                   <apex:outputLink value="{!war.indexurl__c}">
                    <apex:outputText >{!war.anzeigendaten_de_ID_account__c}</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                        
                    <!-- Branche -->
                     <apex:outputPanel layout="block">
                    <apex:outputText >{! war.WirtschaftszweigWZ08__c}</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Link zum Customer Cockpit -->
                    <apex:outputPanel layout="block">
                   <apex:outputLink value="{!war.URL_zum_CC__c}">
                    <apex:outputText >zum Customer Cockpit</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                                         
                    </apex:mapInfoWindow>

                    </apex:mapMarker>
                </apex:repeat>
            </apex:map>

    <!-- TABLE -->
        <apex:pageBlockTable width="30%" value="{!warehouses}"  var="war" >
              
         <apex:column > <input type="checkbox" />
         <apex:facet name="header">Kunde</apex:facet><apex:outputLink value="/{!war.Id}" target="_blank">{!war.Name}</apex:outputLink>
         </apex:column>
         
   <!--      <apex:column ><apex:facet name="header">Straße</apex:facet>{!war.ShippingStreet}</apex:column> -->
   <!--      <apex:column ><apex:facet name="header">Stadt</apex:facet>{!war.ShippingCity}</apex:column> -->
   <!--      <apex:column ><apex:facet name="header">Inhaber</apex:facet>{!war.Accountinhaber_Text__c }</apex:column> -->
   <!--      <apex:column ><apex:facet name="header">Index</apex:facet><apex:outputLink value="{!war.indexurl__c}" target="_blank">{!war.anzeigendaten_de_ID_account__c}</apex:outputLink></apex:column> -->
   <!--      <apex:column ><apex:facet name="header">Customer Cockpit</apex:facet><apex:outputLink value="{!war.URL_zum_CC__c}" target="_blank">zum Customer Cockpit</apex:outputLink></apex:column> -->

      </apex:pageBlockTable>

        </apex:pageBlockSection>

    </apex:pageBlock>
    
    
</apex:page>

When I switch from <apex:pageBlockSection columns="1"> to <apex:pageBlockSection columns="2"> it gets all messed up:

User-added image

What do I have to do?

Hello developers,

I have the following checkbox on my visualforce page:
<apex:inputCheckBox id="filter1" value="{!fcb}">
        <apex:actionSupport event="onclick" action="{!findNearby}" rerender="geomap"/>
        </apex:inputCheckBox>
        <apex:outputLabel for="filter1" value="nur aus verwandter Branche ({!currentAccount.WZ_Abteilung__c})" />

So there is no actual field on the account, it just "exists" on the visualforce page.

I am passing the value to my class who runs different queries depending whether this checkbox is true or false:
 

// FILTER 1 (Branche)
     public boolean fcb { get; set; }
     // FILTER 2 (Owner)
     public boolean fco { get; set; }
     // FILTER 3 (perfect fit)
     public boolean fcf { get; set; }
        
     public FindNearbyController (boolean fcb, boolean fco, boolean fcf) {
     this.fcb = fcb;
     this.fco = fco;
     this.fcf = fcf;
     }
...
if (fcb == true && fco == false)  {
       
       warehouses =  [
                               SELECT Id, Name,URL_zum_CC__c,Mitarbeiternzahl_final__c,Auftragseingangstyp__c,AD_MS_Rel_Anzahl_bez__c,Vollst_ndiger_Name__c,ShippingStreet,LocateCity__longitude__s, LocateCity__latitude__s, OwnerId,GeoLocPosition__c,Accountinhaber_Text__c,WirtschaftszweigWZ08__c,WZ_Code_ebene_2__c,AE_letzte_12_Monate__c,anzeigendaten_de_ID_account__c,indexurl__c
                               FROM Account 
                               WHERE Letzte_gew_Opp_OneSales_in_Tagen__c <= :decimal.valueof(myTime) AND DISTANCE(LocateCity__c, GEOLOCATION(:dlat,:dlon), 'km') < :decimal.valueof(myInput) AND Id != :theaccId AND WZ_Code_ebene_2__c= :currentAccount.WZ_Code_ebene_2__c
                               ORDER BY DISTANCE(LocateCity__c, GEOLOCATION(:dlat,:dlon), 'km')  
                               LIMIT :recordLimit
                      ];

What I am trying to achieve is to set {!fcb} by default to true, so that the 1st query runs with pageload. I already tried "selected = 'true'". While the checkbox gets actually checked, the query does not get fired. Only when I "re-trigger" my "action" it will query. 

I would conclude that 'selecetd = true' is only for "visual" and there is no actual value getting passed to the controller?! Or is event="onclick" the problem?

How can I make this work? That the query runs on pageload with {!fcb} set to true.

Thanks in Advance!

 

Hello developers,

I have created a custom metadata type called 'Geolocation__mdt' with 2 custom fields: Distance__c and Limit__c

What I am (unsuccessfully) trying to achieve is to use the values stored in Distance__c and Limit__c as parameters for my SOQL query:
String queryString =
           'SELECT Id, Name,AD_JobAds_Anz__c,Vollst_ndiger_Name__c,ShippingStreet,LocateCity__longitude__s, LocateCity__latitude__s  ' +
           'FROM Account ' +
           'WHERE DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') <  3 and Kundenstatus_Direktvertrieb__c = \'Bestandskunde\' and Id != :theaccId ' +
           'ORDER BY DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') ' +
'LIMIT 50';
But instead of: 
WHERE DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') <  3
I want to use:
WHERE DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') <  Geolocation__mdt.Distance__c
and instead of :
'LIMIT 50';
I want to use 
'LIMIT = Geolocation__mdt.Limit__c';

The main goal is to stay flexible since the values may change over the course of time and I don't want to touch my code every time.
 

Thanks!


 

Hello developers,

I am tackling a problem which is probably quite straight forward but I can't figure it out:

I have extend the code from https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_maps_example.htm to fit my needs.

In there I have 
public List<Map<String,Double>> locations { get; private set; }
which later gets reffered to here:
// SOQL query to get the nearest warehouses

        String queryString =
           'SELECT Id, Name,AD_JobAds_Anz__c,Vollst_ndiger_Name__c,ShippingStreet,LocateCity__longitude__s, LocateCity__latitude__s  ' +
           'FROM Account ' +
           'WHERE DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') <  3 and Kundenstatus_Direktvertrieb__c = \'Bestandskunde\' and Id != :theaccId ' +
           'ORDER BY DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'km\') '; 
        
        List <Account> warehouses = database.Query(queryString);
                 
        if(0 < warehouses.size()) {
            // Convert to locations that can be mapped
            locations = new List<Map<String,Double>>();
            for (Account wh : warehouses) {
                locations.add(
                    new Map<String,Double>{
                        'latitude' => wh.LocateCity__latitude__s, 
                        'longitude' => wh.LocateCity__longitude__s

Now I am trying to access the fields/values of the account but since it is a List of Maps, this is not working. I have to tranform it to a list that contains the Accounts/sObject?? Then I can access its fields?

Maybe some can share some insights.
Thanks!


 

Hello developers,

I found the following article about "Adding Info Windows to Markers (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_maps_info_windows.htm)" - basically displaying Salesforce data in GoogleMaps.

After a bit of trial and error I have created an apex class and a visualforce page that shows me customers close to the 'current account'

Now I want to top that with "Adding Info Windows to Markers" - Is this possible? Can I display here data of the Account/Marker that got clicked?

Here is my apex class:
 

/* https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_maps_example.htm */

   
    public class FindNearbyController {
     
     public List<Map<String,Double>> locations { get; private set; }
     
     public Account currentAccount {get;set;}
  
     public FindNearbyController(ApexPages.StandardController stdController) {
        currentAccount  = [SELECT ID, Geolocation__c FROM Account WHERE ID =: stdController.getID()];

    }


 
      public String currentPosition { 
        get {
            if (String.isBlank(currentPosition)) {
                currentPosition = currentAccount.Geolocation__c; 

            }
            return currentPosition;
        }
        set; 
    }

    
    public Boolean resultsAvailable {
        get {
            if(locations == Null) {
                return false;
            }
            return true;
        }
    }    

    
    public PageReference findNearby() {
        String lat, lon;

        // FRAGILE: You'll want a better lat/long parsing routine
        // Format: "<latitude>,<longitude>" (must have comma, but only one comma)
        List<String> latlon = currentPosition.split(',');
        lat = latlon[0].trim();
        lon = latlon[1].trim();

        // SOQL query to get the nearest warehouses
        String queryString =
           'SELECT Id, Name,LocateCity__longitude__s, LocateCity__latitude__s  ' +
           'FROM Account ' +
           'WHERE DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'mi\') < 20 and Kundenstatus_Direktvertrieb__c = \'Bestandskunde\' ' +
           'ORDER BY DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'mi\') ' +
           'LIMIT 10';

        // Run the query
        List <Account> warehouses = database.Query(queryString);
        
        if(0 < warehouses.size()) {
            // Convert to locations that can be mapped
            locations = new List<Map<String,Double>>();
            for (Account wh : warehouses) {
                locations.add(
                    new Map<String,Double>{
                        'latitude' => wh.LocateCity__latitude__s, 
                        'longitude' => wh.LocateCity__longitude__s
                    }
                );
            }
        }
        else {
            System.debug('No results. Query: ' + queryString);
        }
                
        return null;
    }
}

Here the visualforce page:

<apex:page standardcontroller="Account" extensions="FindNearbyController" docType="html-5.0" >

    
    <apex:pageBlock >
        <!-- Form field to send currentPosition in request. You can make it
             an <apex:inputHidden> field to hide it. -->
        <apex:pageBlockSection >
            <apex:form >
                <apex:outputLabel for="currentPosition">Bestandskunden in der Nähe</apex:outputLabel> 
                <apex:input size="30" 
                     html-placeholder="Attempting to obtain your position..."
                     id="currentPosition" styleClass="currentPosition" 
                     value="{!currentPosition}" />
                <apex:commandButton action="{!findNearby}" value="Go!"/>
            </apex:form>
        </apex:pageBlockSection>
        
        <!-- Map of the results -->
        <apex:pageBlockSection rendered="{!resultsAvailable}" title="Locations">
        
        
        
            <apex:map width="600px" height="400px" mapType="roadmap">
                <apex:repeat value="{!locations}" var="pos">
                    <apex:mapMarker position="{!pos}"/>
                </apex:repeat>
            </apex:map>
            
            
            
            
        </apex:pageBlockSection>

    </apex:pageBlock>

</apex:page>
 


 

Hello developers,

I have started my first steps in Apex and Visualforce and I got stuck at what I would assume is a easy fix for someone with more experience.
 

I am playing around with geolocations and modified some code that is from salesforce itself:

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_maps_example.htm

What I am trying to achive is to populate dynamically the value of the custom field Geolocation__c of the current account. Right now it is a fixed value.

But obviously I have to query for the account / field first in order to "get" it and then assign it. This is where I'm lost.

Maybe some of you can help. Thanks!
 

     public with sharing class FindNearbyController {
     
     public Contact currentContact {get;set;}

     public List<Map<String,Double>> locations { get; private set; }
    
       
     public String currentPosition { 
        get {
            if (String.isBlank(currentPosition)) {
                currentPosition = '50.7753,6.0839'; 

// here should be the value of the field Geolocation__c from the current account record

            }
            return currentPosition;
        }
        set; 
    }
    
    public Boolean resultsAvailable {
        get {
            if(locations == Null) {
                return false;
            }
            return true;
        }
    }    

    
    public PageReference findNearby() {
        String lat, lon;

        // FRAGILE: You'll want a better lat/long parsing routine
        // Format: "<latitude>,<longitude>" (must have comma, but only one comma)
        List<String> latlon = currentPosition.split(',');
        lat = latlon[0].trim();
        lon = latlon[1].trim();

        // SOQL query to get the nearest warehouses
        String queryString =
           'SELECT Id, Name,LocateCity__longitude__s, LocateCity__latitude__s  ' +
           'FROM Account ' +
           'WHERE DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'mi\') < 50 and Kundenstatus_Direktvertrieb__c = \'Bestandskunde\' ' +
           'ORDER BY DISTANCE(LocateCity__c, GEOLOCATION('+lat+','+lon+'), \'mi\') ' +
           'LIMIT 10';

        // Run the query
        List <Account> warehouses = database.Query(queryString);
        
        if(0 < warehouses.size()) {
            // Convert to locations that can be mapped
            locations = new List<Map<String,Double>>();
            for (Account wh : warehouses) {
                locations.add(
                    new Map<String,Double>{
                        'latitude' => wh.LocateCity__latitude__s, 
                        'longitude' => wh.LocateCity__longitude__s
                    }
                );
            }
        }
        else {
            System.debug('No results. Query: ' + queryString);
        }
                
        return null;
    }
}

How would I write a formula to take a regular date field (11/15/2011) and a text field that represents a time in this format (08:30 AM) into a date/time formula field? Any help is appreciated. Thanks!