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

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 46
    Questions
  • 40
    Replies
Hello everyone,

I have a custom component which displays a datatable - the main part of my component is this:
 
<lightning:datatable 
                         
                         data="{!v.KontingentabrufList}" 
                         columns="{!v.columns}" 
                         keyField="Id"
                         draftValues= "{!v.UpdatedList}"
                         onsave="{!c.SaveUpdatedKontingentabrufe}"
                         hideCheckboxColumn="true"/>
When it comes to the Controller where I define the fields of that table I have one for currency:
 
{label: 'Max Gehalt', fieldName: 'Obere_Gehaltsgrenze__c', type: 'currency',editable: true, 
             	typeAttributes: { step: '0.01', minimumFractionDigits: '2',maximumFractionDigits: '2' }
            },

The problem is when editing the values via Inline Editing he turns:

12,00€ to 1.200€ or 13,50 to 1.350€  (12€ is working fine, he seems to have a problem with the comma - 13.50 turns directly to 1.350€)

I just want him to take the value as I enter it including 2 decimals behind the "comma".

Any suggestions? Thanks!
 

Hello everyone,

I have build a Screen Flow that works just fine. However when I run the same flow (copy) as autolaunched flow he crashes with "Too many SOQL queries: 101" pretty early in the process. 

Not sure what I am missing as the queries are identical?!

Thanks in Advance

Hello everyone,

I am looking for a formula that gives me back a date based on the following idea:
 

TODAY() - X = newDate

where as X only consideres business days. The number of days (x) is stored in custom meta data.

I want to use this in a flow to calculate calls from the last x business days. Based on the formula I am going to substract x by 1 with every query passed. For example with x = 30, my outcome should look something like this:

Get Calls from TODAY () - 30 business days
Get Calls from TODAY () - 29 business days
Get Calls from TODAY () - 28 business days
Get Calls from TODAY () - ...

 

I am grinding my way through the art of lightning components. I am trying to achieve the following:

While being on a record, I want to see another (similiar) record based on a couple of criteria. For example 'JobTitle__c' so that in my lightning card I want to see a record who has the same 'JobTitle__c'as the record I am currently on.

User-added image
Unfortunately I always come back to the same problem: How can I query dynamically for records based on 'JobTitle__c'

All I can find online is
 
action.setParams({
    
    recordId: component.get("v.recordId")
which is not getting me anywhere since it is not the recordId I need but in this case 'JobTitle__c'

Here is my apex class:
public class NextBestPotentialController {
@AuraEnabled
public static List<Lead> getLead (String JobTitle, Id recordId){
String searchTitle = '%' + JobTitle + '%';       
List<Lead> returnlead = new List<Lead>(); 
List<Lead>  myLeads = [SELECT Id,Name,JOB_Titel_letzte_bez_rel_Anzeige__c,company,city
    FROM Lead
    WHERE JOB_Titel_letzte_bez_rel_Anzeige__c LIKE :searchTitle AND Id != :recordId
    LIMIT 1
    
    ];
    
    for(Lead le:myLeads){
    returnlead.add(le);
    } 
    return returnlead ;   }}

my component:
 
<aura:component controller="NextBestPotentialController" implements="flexipage:availableForRecordHome,force:hasRecordId" access="global">

<aura:attribute name="JobTitle" type="String" default="Physio"/>
<aura:attribute name="leadList" type="list" />
<aura:attribute name="recordId" type="Id" />

<aura:handler name="init" value="{!this}" action="{!c.doInit}" />


<div class="slds-grid slds-wrap">
    <aura:iteration items="{!v.leadList}" var="lea"  >
<div class="slds-col slds-size_4-of-4 slds-p-around_small">
    <lightning:card title="Lead Information" footer="Sample footer" iconName="standard:lead">

        <p class="slds-p-horizontal_small">
 ID: {!lea.Id}
       </p>
       <p class="slds-p-horizontal_small">  
Name: {!lea.Name}
        </p> 
            <p class="slds-p-horizontal_small">
 Firma: {!lea.Company}
            </p>
           <p class="slds-p-horizontal_small">
Jobtitle: {!lea.JOB_Titel_letzte_bez_rel_Anzeige__c}
         </p> 
        <aura:set attribute="footer">
        <lightning:badge label="Tag1"/>
        <lightning:badge label="Tag2"/>
        <lightning:badge label="{!lea.JOB_Titel_letzte_bez_rel_Anzeige__c}"/>
    </aura:set>
    </lightning:card>
</div> 


    </aura:iteration>
    </div>
  </aura:component>
my controller:
 
({
 doInit : function(component, event) {

    var action  = component.get('c.getLead');

     action.setParams({
    
    recordId: component.get("v.recordId"),
    JobTitle: component.get("v.JobTitle")
   
});

     action.setCallback(this,function(response){
    var state=response.getState();
    var response1=response.getReturnValue();
    if(state==="SUCCESS")
    {
        component.set("v.leadList",response1);
    }
   
});
$A.enqueueAction(action); }})
So the only reason why I get a result is because I set a default on
<aura:attribute name="JobTitle" type="String" default="Physio"/>

Otherwise it would be null since I dont know how, where and when to populate the values.
 
Hi everyone,

this is probably a very common use case but I am struggling here. I want to make a query in apex based on a string I am sending from my component to the class. But it is not pulling any data. Here is what I got so far:

my ApexClass:
public class NextBestPotentialController {
@AuraEnabled
public static List<Lead> getLead (String JobTitle, Id recordId){
String searchTitle = '%' + JobTitle + '%';           
List<Lead> returnlead = new List<Lead>(); 
List<Lead>  myLeads = [SELECT Id,Name,JOB_Titel_letzte_bez_rel_Anzeige__c,company
        FROM Lead
        WHERE JOB_Titel_letzte_bez_rel_Anzeige__c LIKE :searchTitle AND Id != :recordId
        LIMIT 4
        
        ];
        
        for(Lead le:myLeads){
        returnlead.add(le);
        } 
        return returnlead ;      
    }   
   }

my Component:
<aura:component controller="NextBestPotentialController" implements="flexipage:availableForRecordHome,force:hasRecordId" access="global">

<aura:attribute name="JobTitle" type="String"/>
<aura:attribute name="leadList" type="list" />
<aura:attribute name="recordId" type="Id" />

<aura:handler name="init" value="{!this}" action="{!c.doInit}" />


<div class="slds-grid slds-wrap">
<aura:iteration items="{!v.leadList}" var="lea"  >
    <div class="slds-col slds-size_1-of-4 slds-p-around_small">
<lightning:card title="Lead Information" footer="Sample footer">
    
    <p class="slds-p-horizontal_small">
     ID: {!lea.Id}
     </p>
    <p class="slds-p-horizontal_small">  
    Name: {!lea.Name}
    </p> 
    <p class="slds-p-horizontal_small">
     Firma: {!lea.Company}
     </p>
    <p class="slds-p-horizontal_small">
    Jobtitle: {!lea.JOB_Titel_letzte_bez_rel_Anzeige__c}
      </p> 

</lightning:card>
    </div> 


</aura:iteration>
</div>
  </aura:component>

my Controller:
 
({
 doInit : function(component, event) {
   
        var action  = component.get('c.getLead');
//  var JobTitle = component.get("v.JOB_Titel_letzte_bez_rel_Anzeige__c");
 
    action.setParams({
        
        recordId: component.get("v.recordId"),
        JobTitle: component.get("v.JOB_Titel_letzte_bez_rel_Anzeige__c")
       
    });
   
    action.setCallback(this,function(response){
        var state=response.getState();
        var response1=response.getReturnValue();
        if(state==="SUCCESS")
        {
            component.set("v.leadList",response1);
        }
       
    });
    $A.enqueueAction(action);
 }
})

The 'recordId' is getting passed to the class and working just fine. But lets say my 'Jobtitle' is 'developer' on my Lead record, nothing is getting passed and he is return leads where the 'Jobtitle' field is empty.

What do I need to do to make the controller understand that he should pull the 'Jobtitle' from the current lead and pass it to the class?!

I would like it to be generic to query leads based on the current leads jobtitle

Hello everyone,

I am getting started with Lighting Components and build my own first tabe. I am displaying all quotedocuments from all quotes on the opportunity level so that our sales sees all documents in one table and does not have to open every single quote. Here is what I got so far:

User-added image

Now with Sales being Sales they make mistakes and create quotedocuments (pdfs) they dont actually need. So they need to be able to delete these quotedocuments in this table. That is the point where I am stuck. I found some documentation but I always end up with deleting the entire opportunity. My biggest challenge is to access every single quotedocument based on the row the button is hit.

Here is my apex class:

public class JTo_ListOfPDFs {
    @AuraEnabled
public static List <Quote> getPDF(Id opportunityId) 
    {
        return [SELECT Id,Name,CreatedDate,QuoteNumber,TotalPrice,(SELECT Id,CreatedDate,Name,ContentVersionDocumentId,QuoteId FROM QuoteDocuments )FROM Quote WHERE OpportunityId =  :opportunityId ORDER BY Id DESC];
         
    }    
}
The component
<aura:component controller="JTo_ListOfPDFs" implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    
	<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:dependency resource="markup://force:editRecord" type="EVENT" />
    <aura:handler event="force:refreshView" action="{!c.doInit}" />

    <!--aura attributes--> 
    <aura:attribute name="quoteDocumentRows" type="Object[]"/>
    <aura:attribute name="recordId" type="Id" />

    <!--Page header-->
    <div class="slds-page-header" role="banner">
        <span class="slds-text-heading_medium">List of PDFs</span>
        <ui:button class="btn" press="{!c.setOutput}"/>
    </div>

     <!--Lightning data table markup-->
    <table class="slds-table slds-table--bordered slds-table--cell-buffer">
	 	<thead>
		    <tr class="slds-text-title_caps">
                
                
                <th scope="col">
		        <div class="slds-truncate" title="Quote">Quote Number</div>
		      </th>
                
                              
		      <th scope="col">
                    <div class="slds-truncate" title="Name">PDF</div>
		      </th>
		      <th scope="col">
		        <div class="slds-truncate" title="Date">Date</div>
		      </th>
                <th scope="col">
		        <div class="slds-truncate" title="Date">Delete</div>
		      </th>
            </tr>
		   </thead>
  	<tbody>
   <aura:iteration items="{!v.quoteDocumentRows}" var="cell" >
     <aura:iteration items="{!cell.QuoteDocuments}" var="pdf"  >	

 	 <tr>
         
         <td data-label="Quote Number">
        <div class="slds-truncate" title="Quote Number">
            <a href="{! '/'+cell.Id}" target="_blank">{!cell.QuoteNumber} </a>
      </div>
          </td>

      <td data-label="PDF">
        <div class="slds-truncate" title="PDF">
            <a href="{!'https://meinestadt--partial.lightning.force.com/servlet/servlet.FileDownload?file='+ pdf.Id}" target="_blank">{!pdf.Name} </a>
      </div>
          </td>
        
      <td data-label="Date"> <lightning:formattedDateTime year="numeric" month="numeric" day="numeric"  hour="2-digit" minute="2-digit" value="{!pdf.CreatedDate}" /> 
       
      </td>
       <td>
         <lightning:buttonIcon aura:id="deleteButton" iconName="utility:close" size="small" variant="border-filled" alternativeText="Close"/>
            </td>
    </tr>
	 </aura:iteration>
	</aura:iteration>
    
  </tbody>	
	
  </table>
    
 
</aura:component>
The controller
({
    doInit : function(component, event, helper){
        helper.getAllPDFs(component);
        
    }    
    
})
The Helper
({
	getAllPDFs : function(component, event, helper) {
        var action = component.get("c.getPDF");
        action.setCallback(this, function(a){
            component.set("v.quoteDocumentRows", a.getReturnValue());
        });
        action.setParams({
            opportunityId: component.get("v.recordId")
        });
       //https://developer.salesforce.com/blogs/developer-relations/2015/11/building-context-aware-lightning-components.html
        $A.enqueueAction(action);
	},
    setOutput : function(component, event, helper) {
        var editRecordEvent = $A.get("e.force:editRecord");
        editRecordEvent.setParams({
             "recordId": component.get("v.recordId")
        });
        editRecordEvent.fire();
	}
})

Can anyone point me in the right direction?  That would be great.

Thanks in Advance!

 

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 everyone,

I have build a Screen Flow that works just fine. However when I run the same flow (copy) as autolaunched flow he crashes with "Too many SOQL queries: 101" pretty early in the process. 

Not sure what I am missing as the queries are identical?!

Thanks in Advance

Hi everyone,

this is probably a very common use case but I am struggling here. I want to make a query in apex based on a string I am sending from my component to the class. But it is not pulling any data. Here is what I got so far:

my ApexClass:
public class NextBestPotentialController {
@AuraEnabled
public static List<Lead> getLead (String JobTitle, Id recordId){
String searchTitle = '%' + JobTitle + '%';           
List<Lead> returnlead = new List<Lead>(); 
List<Lead>  myLeads = [SELECT Id,Name,JOB_Titel_letzte_bez_rel_Anzeige__c,company
        FROM Lead
        WHERE JOB_Titel_letzte_bez_rel_Anzeige__c LIKE :searchTitle AND Id != :recordId
        LIMIT 4
        
        ];
        
        for(Lead le:myLeads){
        returnlead.add(le);
        } 
        return returnlead ;      
    }   
   }

my Component:
<aura:component controller="NextBestPotentialController" implements="flexipage:availableForRecordHome,force:hasRecordId" access="global">

<aura:attribute name="JobTitle" type="String"/>
<aura:attribute name="leadList" type="list" />
<aura:attribute name="recordId" type="Id" />

<aura:handler name="init" value="{!this}" action="{!c.doInit}" />


<div class="slds-grid slds-wrap">
<aura:iteration items="{!v.leadList}" var="lea"  >
    <div class="slds-col slds-size_1-of-4 slds-p-around_small">
<lightning:card title="Lead Information" footer="Sample footer">
    
    <p class="slds-p-horizontal_small">
     ID: {!lea.Id}
     </p>
    <p class="slds-p-horizontal_small">  
    Name: {!lea.Name}
    </p> 
    <p class="slds-p-horizontal_small">
     Firma: {!lea.Company}
     </p>
    <p class="slds-p-horizontal_small">
    Jobtitle: {!lea.JOB_Titel_letzte_bez_rel_Anzeige__c}
      </p> 

</lightning:card>
    </div> 


</aura:iteration>
</div>
  </aura:component>

my Controller:
 
({
 doInit : function(component, event) {
   
        var action  = component.get('c.getLead');
//  var JobTitle = component.get("v.JOB_Titel_letzte_bez_rel_Anzeige__c");
 
    action.setParams({
        
        recordId: component.get("v.recordId"),
        JobTitle: component.get("v.JOB_Titel_letzte_bez_rel_Anzeige__c")
       
    });
   
    action.setCallback(this,function(response){
        var state=response.getState();
        var response1=response.getReturnValue();
        if(state==="SUCCESS")
        {
            component.set("v.leadList",response1);
        }
       
    });
    $A.enqueueAction(action);
 }
})

The 'recordId' is getting passed to the class and working just fine. But lets say my 'Jobtitle' is 'developer' on my Lead record, nothing is getting passed and he is return leads where the 'Jobtitle' field is empty.

What do I need to do to make the controller understand that he should pull the 'Jobtitle' from the current lead and pass it to the class?!

I would like it to be generic to query leads based on the current leads jobtitle

Hello everyone,

I am getting started with Lighting Components and build my own first tabe. I am displaying all quotedocuments from all quotes on the opportunity level so that our sales sees all documents in one table and does not have to open every single quote. Here is what I got so far:

User-added image

Now with Sales being Sales they make mistakes and create quotedocuments (pdfs) they dont actually need. So they need to be able to delete these quotedocuments in this table. That is the point where I am stuck. I found some documentation but I always end up with deleting the entire opportunity. My biggest challenge is to access every single quotedocument based on the row the button is hit.

Here is my apex class:

public class JTo_ListOfPDFs {
    @AuraEnabled
public static List <Quote> getPDF(Id opportunityId) 
    {
        return [SELECT Id,Name,CreatedDate,QuoteNumber,TotalPrice,(SELECT Id,CreatedDate,Name,ContentVersionDocumentId,QuoteId FROM QuoteDocuments )FROM Quote WHERE OpportunityId =  :opportunityId ORDER BY Id DESC];
         
    }    
}
The component
<aura:component controller="JTo_ListOfPDFs" implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    
	<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:dependency resource="markup://force:editRecord" type="EVENT" />
    <aura:handler event="force:refreshView" action="{!c.doInit}" />

    <!--aura attributes--> 
    <aura:attribute name="quoteDocumentRows" type="Object[]"/>
    <aura:attribute name="recordId" type="Id" />

    <!--Page header-->
    <div class="slds-page-header" role="banner">
        <span class="slds-text-heading_medium">List of PDFs</span>
        <ui:button class="btn" press="{!c.setOutput}"/>
    </div>

     <!--Lightning data table markup-->
    <table class="slds-table slds-table--bordered slds-table--cell-buffer">
	 	<thead>
		    <tr class="slds-text-title_caps">
                
                
                <th scope="col">
		        <div class="slds-truncate" title="Quote">Quote Number</div>
		      </th>
                
                              
		      <th scope="col">
                    <div class="slds-truncate" title="Name">PDF</div>
		      </th>
		      <th scope="col">
		        <div class="slds-truncate" title="Date">Date</div>
		      </th>
                <th scope="col">
		        <div class="slds-truncate" title="Date">Delete</div>
		      </th>
            </tr>
		   </thead>
  	<tbody>
   <aura:iteration items="{!v.quoteDocumentRows}" var="cell" >
     <aura:iteration items="{!cell.QuoteDocuments}" var="pdf"  >	

 	 <tr>
         
         <td data-label="Quote Number">
        <div class="slds-truncate" title="Quote Number">
            <a href="{! '/'+cell.Id}" target="_blank">{!cell.QuoteNumber} </a>
      </div>
          </td>

      <td data-label="PDF">
        <div class="slds-truncate" title="PDF">
            <a href="{!'https://meinestadt--partial.lightning.force.com/servlet/servlet.FileDownload?file='+ pdf.Id}" target="_blank">{!pdf.Name} </a>
      </div>
          </td>
        
      <td data-label="Date"> <lightning:formattedDateTime year="numeric" month="numeric" day="numeric"  hour="2-digit" minute="2-digit" value="{!pdf.CreatedDate}" /> 
       
      </td>
       <td>
         <lightning:buttonIcon aura:id="deleteButton" iconName="utility:close" size="small" variant="border-filled" alternativeText="Close"/>
            </td>
    </tr>
	 </aura:iteration>
	</aura:iteration>
    
  </tbody>	
	
  </table>
    
 
</aura:component>
The controller
({
    doInit : function(component, event, helper){
        helper.getAllPDFs(component);
        
    }    
    
})
The Helper
({
	getAllPDFs : function(component, event, helper) {
        var action = component.get("c.getPDF");
        action.setCallback(this, function(a){
            component.set("v.quoteDocumentRows", a.getReturnValue());
        });
        action.setParams({
            opportunityId: component.get("v.recordId")
        });
       //https://developer.salesforce.com/blogs/developer-relations/2015/11/building-context-aware-lightning-components.html
        $A.enqueueAction(action);
	},
    setOutput : function(component, event, helper) {
        var editRecordEvent = $A.get("e.force:editRecord");
        editRecordEvent.setParams({
             "recordId": component.get("v.recordId")
        });
        editRecordEvent.fire();
	}
})

Can anyone point me in the right direction?  That would be great.

Thanks in Advance!

 

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!


 

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!