• Sascha Deinert
  • NEWBIE
  • 250 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 94
    Questions
  • 129
    Replies
Hello, 

I have a very simple trigger which is working fine in the sandbox but it doesn't work in the production. If someone change the owner of the opportunity or add a new opportunity the customfield team__c should be filled with the owner team value. But if I change the owner the field keep blank. If I change the team field at the opportunity manuelly and then I change the owner then becomes the field also blank.
 
trigger setTeamOpportunity on Opportunity (before update) {

 for(Opportunity o : trigger.new) { 
     Opportunity oldOpportunity = trigger.OldMap.get(o.ID);
         if(o.ownerid != oldOpportunity.ownerid) {
                    o.Team__c = o.Owner.Team__c;
         }
     }
}
Can someone help me please.

Thanks,
Sascha
Hi,

I have two maps and I want to merge this maps into one list, key should be the account. My goal is an overview of the accounts with the opportunities.
How can I merge these lists?
 
public map<Id, Account> getMapFieldLabel1() {
    Map<Id, Account> mapField_Label1= new Map<Id, Account>([SELECT Id, Name FROM Account LIMIT 10]);
    return mapField_Label1;
}

public map<Id, Opportunity> getMapFieldLabel2() {
    Map<Id, Opportunity> mapField_Label2= new Map<Id, Opportunity>([SELECT Id, Account.Id, Name FROM Opportunity]);
    return mapField_Label2;
}
<apex:pageBlockSection columns="2" collapsible="false">              
            <apex:repeat value="{!MapFieldLabel1}" var="item" >
                  <apex:outputText value="{!MapFieldLabel1[item].Id}" />
                   <apex:outputText value="{!MapFieldLabel1[item].Name}" />
            </apex:repeat>   
            </apex:pageBlockSection>
 </apex:pageblock>
 <br/><br/>
 <apex:pageblock>
  <apex:pageBlockSection columns="3" collapsible="false">              
            <apex:repeat value="{!MapFieldLabel2}" var="item" >
                  <apex:outputText value="{!MapFieldLabel2[item].Account.Id}" />
                  <apex:outputText value="{!MapFieldLabel2[item].Id}" />
                   <apex:outputText value="{!MapFieldLabel2[item].Name}" />
            </apex:repeat>   
            </apex:pageBlockSection>
 </apex:pageblock>
Thanks,
Sascha

 
Hi,

I need for our sales colleagues to a list of responsible accounts for sales planning. I can do that quickly with a report, but I need this list enriched with additional information. For example sales last year (sales object), sales current year (sales object), current planning (object opportunity).

Can I build a report that displays the cumulative values ​​of these objects?
If not, how can I solve this via a visualforce site?
 
AccountSales Last YearSales Current YearOpportunity Amount
ABC5.00020.00050.000
DEF10.0005.00025.000
GHI01.5000


Thanks,
Sascha
Hi,

I've tried to add two aggregate results in one list, but I don't know if its correct because I don't know how can I show the results at the visualforce page.

Just for testing....
What is my plan, I want to count the number of accounts grouped by account Id, this make no sense but for the test its ok and on the other hand I want to count the number of sales and the sum of the sales grouped by account Id. The both aggregate results should be maped into one list.

Could you tell me is my code correct and how can I display the results?
 
Public Class VTP32_class {

    public String CombinedSummary { get; set; }

Public VTP32_class() {

}

Public class CombinedSummary {
    public Integer CountAcc {get; set;}
    public Id UId {get; set;} 
    public Integer CountSales {get; set;}
    public Double Brutto_BWS {get; set;}  
    
Public CombinedSummary (AggregateResult arM, AggregateResult arS) {
    CountAcc = (Integer) arM.get('CountAcc');
    UID = (Id) arS.get('Id');
    CountSales = (Integer) arS.get('CountSales');
    Brutto_BWS = (Double) arS.get('Brutto_BWS');
    }
}

Public List<CombinedSummary> generateWrappers() {
        Map<Id, AggregateResult> AccMap = new Map<Id, AggregateResult>();
        Map<Id, AggregateResult> AccSales = new Map <Id, AggregateResult>();

        List<CombinedSummary> combinedSummaries = new List<CombinedSummary>();
      
        FOR(AggregateResult arM: [SELECT COUNT(OwnerId) CountAcc, Id FROM Account GROUP BY Id]) {
            AccMap.put((Id)arM.get('Id'), arM);
        }
       
        FOR(AggregateResult arS: [SELECT COUNT(Id) CountSales, SUM(BWS_Brutto__c) Brutto_BWS, Einzelrisiko__r.Gruppenvertrag__r.Unternehmen__r.Id FROM Umsatz__c GROUP BY Einzelrisiko__r.Gruppenvertrag__r.Unternehmen__r.Id]) {
            AccSales.put((Id)arS.get('Einzelrisiko__r.Gruppenvertrag__r.Unternehmen__r.Id'), arS);
        }
            
        Set<Id> AccSet = new Set<Id>();
        AccSet = AccSales.keySet();
        AccSet.addAll(AccSales.keySet());
        
        FOR (Id Id : AccSet) {
            combinedSummaries.add(new CombinedSummary(AccMap.get(Id), AccSales.get(Id)));
        }
        
        Return combinedSummaries;
    
}

}
Thanks,
Sascha
Hello,

I need a overview like a table of all accounts and additional the sum of sales 2017, sum of current sales, sum of opportunities.
How can I to this?

Accountname | Sales 2017 | Sales 2018 | Opps 
----------------------------------------------------------------------
ABC               |        15.000 |          2.000 |       20.000
XYZ               |                 0 |        10.000 |       50.000

Thanks,
Sascha
 
Hello,

I have a list with contract numbers which are displayed in a visualforce page, the user could select the numbers which he will need for the analysis. The user should check the checkbox from the contract (multiple choices possible), how can I transport the checked contracts to the nextpage or anlayze?
 
public class Contract_class {

private Id accId {get; set;}

public Contract_class() {
accId = ApexPages.currentPage().getParameters().get('id');

}

public List<Contract__c> getContracts() {
    List<Contract__c> Contracts = [SELECT Name FROM Contract__c WHERE Account_ID_Long__c = :accId];
    RETURN Contracts;
}

public PageReference nextPage () {    
        
    return new PageReference('/apex/Contract_next?id='+accid);   
  
} 

}
<apex:page controller="Contract_class">

<apex:form >

<apex:repeat value="{!Contracts}" var="con">
<apex:inputCheckbox value="{!con.Name}" selected="true" />
<apex:outputField value="{!con.Name}" />
</apex:repeat>

<table>
    <tr>
        <td>
            <apex:commandbutton value="analyze" action="{!nextPage}" />
        </td>
    </tr>
</table>

</apex:form>

</apex:page>
Thanks,
Sascha

 
Hi,

I have some question about the Lightning Design System.
Below you will find a screen and the code for this screen. 

Can I put the text closer to the left border?
Can I change the backgroundcolor from the Header or the marked item?
Can I change the margin between the different items?

Pic1
 
<apex:page standardStylesheets="false" docType="html-5.0">
    
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" lang="en">

<apex:slds /> 
    
<div class="slds-scope">
 
<div class="Navigation" style="width: 180px;">
<nav class="slds-nav-vertical slds-nav-vertical_compact" aria-label="Sub page">
<div class="slds-nav-vertical__section">
    <h2 id="entity-header" class="slds-nav-vertical__title slds-text-title_caps"><b>Header 1</b></h2>
<ul>   
    <li class="slds-nav-vertical__item"><a href="" target="_parent" class="slds-nav-vertical__action" aria-describedby="entity-header">Test 1</a></li>
    <li class="slds-nav-vertical__item"><a href="" target="_parent" class="slds-nav-vertical__action" aria-describedby="entity-header">Test 2</a></li>
    <li class="slds-nav-vertical__item"><a href="" target="_parent" class="slds-nav-vertical__action" aria-describedby="entity-header">Test 3</a></li>
</ul>
</div>
    
<div class="slds-nav-vertical__section">
    <h2 id="folder-header" class="slds-nav-vertical__title slds-text-title_caps"><b>Header 2</b></h2>
<ul>
    <li class="slds-nav-vertical__item"><a href="" target="_parent" class="slds-nav-vertical__action" aria-describedby="folder-header">Test 1</a></li>
    <li class="slds-nav-vertical__item"><a href="" target="_parent" class="slds-nav-vertical__action" aria-describedby="folder-header">Test 2</a></li>
</ul>
</div>
    
</nav>
    
</div>
        
</div> <!-- ENDE SLDS-SCOPE -->

</html>
    
</apex:page>
Thanks,
Sascha

Hi,

I have a list of data which I have collected as following:
 
public List <MediaData__c> getMDList() 
{ 
List <MediaData__c> MDList = [SELECT Id, Description__c, Topic__c, FROM MediaData__c]; 
} 
return MDList; 
}

I've stored in the different MediaData records a files which I want to add to the MDList. The files are stored in ContentDocumentLink, the relationfield for the MediaData and the ContentDocumentLink is LinkedEntityId.

How can I add the fileinformation to the MDList?

Later I want to show the list at a visualforce page and a preview of the files.

Thanks,
Sascha
 
Hi,
in Salesforce lightning in files or Notes/Attachments of a contact or account you can see a preview of the first page from a stored pdf.
How is that possible?

Here is the code which I extract from the page.
<img src="https://DOMAIN.content.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB120BY90&amp;versionId=0688E00000091mE&amp;operationContext=CHATTER&amp;contentId=05T8E0000009v54" class="thumbnailImg medium" alt="PDF">

Screenshot:
User-added image

Thanks,
Sascha
Hi,

I test the code from salesforce to unsubscribe via mail, below you will find the original code from salesforce. This works fine, but what is happen if the unsubscriber send an email to salesforce without the subject string "unsubscribe". Can I see this mails somewhere?
 
Global class unsubscribe implements Messaging.inboundEmailHandler{

    Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, 
                         Messaging.InboundEnvelope env ) {
    
        // Create an inboundEmailResult object for returning 
        // the result of the email service.
        Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
         
        // Create contact and lead lists to hold all the updated records.
        List<Contact> lc = new List <contact>();
        List<Lead> ll = new List <lead>();
         
        // Convert the subject line to lower case so the program can match on lower case.
        String mySubject = email.subject.toLowerCase();
        // The search string used in the subject line.
        String s = 'unsubscribe';
         
        // Check the variable to see if the word "unsubscribe" was found in the subject line. 
        Boolean unsubMe;
        // Look for the word "unsubcribe" in the subject line. 
        // If it is found, return true; otherwise, return false.
        unsubMe = mySubject.contains(s);
         
         // If unsubscribe is found in the subject line, enter the IF statement.
         
        if (unsubMe == true) {
            
            try {
               
            // Look up all contacts with a matching email address.
               
            for (Contact c : [SELECT Id, Name, Email, HasOptedOutOfEmail
                          FROM Contact
                          WHERE Email = :env.fromAddress
                          AND hasOptedOutOfEmail = false
                          LIMIT 100]) {
                          
                // Add all the matching contacts into the list.   
                c.hasOptedOutOfEmail = true;
                lc.add(c);
            }
            // Update all of the contact records.
            update lc;
        }
        catch (System.QueryException e) {
            System.debug('Contact Query Issue: ' + e);
        }   
        
        try {
            // Look up all leads matching the email address.
            for (Lead l : [SELECT Id, Name, Email, HasOptedOutOfEmail
                     FROM Lead
                     WHERE Email = :env.fromAddress
                     AND isConverted = false
                     AND hasOptedOutOfEmail = false
                     LIMIT 100]) {
                // Add all the leads to the list.       
                l.hasOptedOutOfEmail = true;
                ll.add(l);
                   
                System.debug('Lead Object: ' + l);   
            } 
            // Update all lead records in the query.
            update ll;
        }
        
        catch (System.QueryException e) {
            System.debug('Lead Query Issue: ' + e);
        }   
        
        System.debug('Found the unsubscribe word in the subject line.');
         } 
         else {
            System.debug('No Unsuscribe word found in the subject line.' );
         }
        // Return True and exit.
        // True confirms program is complete and no emails 
        // should be sent to the sender of the unsubscribe request. 
        result.success = true;
        return result;
    }   
}

thanks,
Sascha
HI,

If I click on the button the parameter calc_view should set to value 1.
But the value is still 0.

Please help me.
 
<apex:commandButton value="CALC" onclick="window.open('/apex/calc_test','_blank','height=500,width=500,toolbar=no,scrollbars=no,resizeable=no,menubar=no,top=200,left=200'); return false;">
	<apex:param name="TEST" value="1" assignTo="{!calc_view}"/>
</apex:commandButton>
 
public class calc_class {

    public Integer calc_VIEW {get; set;}
    
    public Double value1 {get; set;}
    public Double value2 {get; set;}
    
    public calc_class() {
        calc_VIEW = 0;
    }
	
    
    public PageReference Pr_calc() {
        value2= value1/ 3.35 * 100;
        return new PageReference('/apex/calc_test');   
    }

}
Thanks,
Sascha
 
Hi,

I wanna add a visual force component to a dashboard and I need the information of the filter field (see below).
It is possible to get the value of the filter field "filter by"?

Dashboard Filter

Thanks,
Sascha

 
Hi,

I want to add a visualforce component to the dashboard.
Can I use the filter criteria to adjust the visualforce component? How can I read this criteria to use it for the visualforce?

Thanks,
Sascha
Hi,

I wanna add a visualforce component to a dynamic dashboard.
For the dynamic I need the name of the dashboard or the filter criteria of an embeded report. How can I read this information?
Unfortunately can't use the filter of the dashboard, because then are the use of visualforce no more possible.

Thanks,
Sascha
Dear All,

I have the following code and I want to show the value at the top of the bars.
Could you help me.
 
<apex:page controller="Samplepage_class" sidebar="true"> 
    
<apex:includeScript id="a" value="https://www.google.com/jsapi" />

<apex:pageblock title="Samplepage">

<div id="chart_div"></div>
        
<script type="text/javascript">

google.load('visualization', '1.1', {'packages': ['bar']});

google.setOnLoadCallback(drawStuff);

function drawStuff() {
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Team');
    data.addColumn('number', 'Level 1');
    data.addColumn('number', 'Level 2');
    data.addColumn('number', 'Level 3');
    data.addColumn('number', 'Level 4');
    data.addColumn('number', 'YTD');    
    data.addRows([
        ['Team1',  {!Level1_Team1}, {!Level2_Team1}, {!Level3_Team1}, {!Level4_Team1}, {!YTD_Team1}],
        ['Team2',  {!Level1_Team2}, {!Level2_Team2}, {!Level3_Team2}, {!Level4_Team2}, {!YTD_Team2}],
    ]);

    // Set chart options
    var options = {
        isStacked: true,
        width: 850,
        height: 500,
        backgroundColor: '#F8F8F8',
        
        chartArea: { backgroundColor: '#F8F8F8' },

        chart: {
<!--            title: 'SamplePage', -->
            subtitle: 'SampleSubTitle'
        },        
        vAxis: {
            format: 'decimal',
            viewWindow: {
                min: 0,
                max: 15000000
            }
        },
        series: {
            4: { targetAxisIndex: 1 }, 
            5: { targetAxisIndex: 1 }
        }
    };

    var chart = new google.charts.Bar(document.getElementById('chart_div'));
    chart.draw(data, google.charts.Bar.convertOptions(options));
};   

</script>

</apex:pageblock>

</apex:page>
Thanks,
Sascha
Hi,

I searched a lot with google but I didn't find a chartstyle where I can group and stack the numbers in one chart.

https://developers.google.com/chart/interactive/docs/gallery/barchart#stacked-bar-charts
https://developers.google.com/chart/interactive/docs/gallery/barchart#creating-material-bar-charts

Is this possible to have a combination of stacked and grouped bars?

Thanks,
Sascha
 
Hi,

I create a right method, but how can I use the s variable for the insert into the stats object?

Thanks,
Sascha
 
public class Stats_class {

public Stats_class() {
}

Public String Right(String s, Integer I) {
S = ApexPages.currentPage().getUrl();
I = 15;

return s;
}

public pagereference dmlop() {

    Stats__c sta = new Stats__c();
    sta.User__c = Userinfo.getUserId();    
    sta.Site__c = ApexPages.currentPage().getUrl();
    INSERT sta;
    RETURN NULL;
}

}

 
Hi,

I like to add the information 'Kon' to the custom object 'Stats__c' if I call the visualforce page.
But I get the error: DML currently not allowed.

Could you help me.


Thanks,
Sascha
 
public class Stats_class {

public Stats_class() {

Stats__c sta = new Site__c();
sta.Site__c = 'Kon';
INSERT sta;

}

}
 
<apex:page controller="Stats_class">

Stats

</apex:page>

 
Hi,

I tried to change the desgin to the tab view and I add the following code.
But now the help text icon is avaiable but the mouse over doesn't work anymore.
And the inline edit is also not possible.

Can I change the code to use the above mentioned functions?
 
<apex:page standardController="Account" showHeader="true" 
      tabStyle="account" >
   <style>
      .activeTab {background-color: #236FBD; color:white; 
         background-image:none}
      .inactiveTab { background-color: lightgrey; color:black; 
         background-image:none}
   </style>
   <apex:tabPanel switchType="client" selectedTab="tabdetails" 
                  id="AccountTabPanel" tabClass="activeTab" 
                  inactiveTabClass="inactiveTab">   
      <apex:tab label="Details" name="AccDetails" id="tabdetails">
         <apex:detail relatedList="false" title="true"/>
      </apex:tab>
      <apex:tab label="Contacts" name="Contacts" id="tabContact">
         <apex:relatedList subject="{!account}" list="contacts" />
      </apex:tab>
      <apex:tab label="Opportunities" name="Opportunities" 
                id="tabOpp">
         <apex:relatedList subject="{!account}" 
                           list="opportunities" />
      </apex:tab>
      <apex:tab label="Open Activities" name="OpenActivities" 
                id="tabOpenAct">
         <apex:relatedList subject="{!account}" 
                           list="OpenActivities" />
      </apex:tab>
      <apex:tab label="Notes and Attachments" 
                name="NotesAndAttachments" id="tabNoteAtt">
         <apex:relatedList subject="{!account}" 
                           list="CombinedAttachments" />
      </apex:tab>
   </apex:tabPanel>
</apex:page>

Thanks,
Sascha
Hi,

 don't know why, but the help text and the helptextimage does not appear.
<apex:pageBlockSectionItem helpText="{!$ObjectType.Opportunity.Fields.StageName.inlineHelpText}">
             <apex:outputLabel value="{!$ObjectType.Opportunity.Fields.StageName.label}" />
             <apex:inputField value="{!oppString.StageName}" />
         </apex:pageBlockSectionItem>

Thanks,
Sascha
Hi,

I have two maps and I want to merge this maps into one list, key should be the account. My goal is an overview of the accounts with the opportunities.
How can I merge these lists?
 
public map<Id, Account> getMapFieldLabel1() {
    Map<Id, Account> mapField_Label1= new Map<Id, Account>([SELECT Id, Name FROM Account LIMIT 10]);
    return mapField_Label1;
}

public map<Id, Opportunity> getMapFieldLabel2() {
    Map<Id, Opportunity> mapField_Label2= new Map<Id, Opportunity>([SELECT Id, Account.Id, Name FROM Opportunity]);
    return mapField_Label2;
}
<apex:pageBlockSection columns="2" collapsible="false">              
            <apex:repeat value="{!MapFieldLabel1}" var="item" >
                  <apex:outputText value="{!MapFieldLabel1[item].Id}" />
                   <apex:outputText value="{!MapFieldLabel1[item].Name}" />
            </apex:repeat>   
            </apex:pageBlockSection>
 </apex:pageblock>
 <br/><br/>
 <apex:pageblock>
  <apex:pageBlockSection columns="3" collapsible="false">              
            <apex:repeat value="{!MapFieldLabel2}" var="item" >
                  <apex:outputText value="{!MapFieldLabel2[item].Account.Id}" />
                  <apex:outputText value="{!MapFieldLabel2[item].Id}" />
                   <apex:outputText value="{!MapFieldLabel2[item].Name}" />
            </apex:repeat>   
            </apex:pageBlockSection>
 </apex:pageblock>
Thanks,
Sascha

 
Hi,

I've tried to add two aggregate results in one list, but I don't know if its correct because I don't know how can I show the results at the visualforce page.

Just for testing....
What is my plan, I want to count the number of accounts grouped by account Id, this make no sense but for the test its ok and on the other hand I want to count the number of sales and the sum of the sales grouped by account Id. The both aggregate results should be maped into one list.

Could you tell me is my code correct and how can I display the results?
 
Public Class VTP32_class {

    public String CombinedSummary { get; set; }

Public VTP32_class() {

}

Public class CombinedSummary {
    public Integer CountAcc {get; set;}
    public Id UId {get; set;} 
    public Integer CountSales {get; set;}
    public Double Brutto_BWS {get; set;}  
    
Public CombinedSummary (AggregateResult arM, AggregateResult arS) {
    CountAcc = (Integer) arM.get('CountAcc');
    UID = (Id) arS.get('Id');
    CountSales = (Integer) arS.get('CountSales');
    Brutto_BWS = (Double) arS.get('Brutto_BWS');
    }
}

Public List<CombinedSummary> generateWrappers() {
        Map<Id, AggregateResult> AccMap = new Map<Id, AggregateResult>();
        Map<Id, AggregateResult> AccSales = new Map <Id, AggregateResult>();

        List<CombinedSummary> combinedSummaries = new List<CombinedSummary>();
      
        FOR(AggregateResult arM: [SELECT COUNT(OwnerId) CountAcc, Id FROM Account GROUP BY Id]) {
            AccMap.put((Id)arM.get('Id'), arM);
        }
       
        FOR(AggregateResult arS: [SELECT COUNT(Id) CountSales, SUM(BWS_Brutto__c) Brutto_BWS, Einzelrisiko__r.Gruppenvertrag__r.Unternehmen__r.Id FROM Umsatz__c GROUP BY Einzelrisiko__r.Gruppenvertrag__r.Unternehmen__r.Id]) {
            AccSales.put((Id)arS.get('Einzelrisiko__r.Gruppenvertrag__r.Unternehmen__r.Id'), arS);
        }
            
        Set<Id> AccSet = new Set<Id>();
        AccSet = AccSales.keySet();
        AccSet.addAll(AccSales.keySet());
        
        FOR (Id Id : AccSet) {
            combinedSummaries.add(new CombinedSummary(AccMap.get(Id), AccSales.get(Id)));
        }
        
        Return combinedSummaries;
    
}

}
Thanks,
Sascha
Hello,

I need a overview like a table of all accounts and additional the sum of sales 2017, sum of current sales, sum of opportunities.
How can I to this?

Accountname | Sales 2017 | Sales 2018 | Opps 
----------------------------------------------------------------------
ABC               |        15.000 |          2.000 |       20.000
XYZ               |                 0 |        10.000 |       50.000

Thanks,
Sascha
 
Hi,

I test the code from salesforce to unsubscribe via mail, below you will find the original code from salesforce. This works fine, but what is happen if the unsubscriber send an email to salesforce without the subject string "unsubscribe". Can I see this mails somewhere?
 
Global class unsubscribe implements Messaging.inboundEmailHandler{

    Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, 
                         Messaging.InboundEnvelope env ) {
    
        // Create an inboundEmailResult object for returning 
        // the result of the email service.
        Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
         
        // Create contact and lead lists to hold all the updated records.
        List<Contact> lc = new List <contact>();
        List<Lead> ll = new List <lead>();
         
        // Convert the subject line to lower case so the program can match on lower case.
        String mySubject = email.subject.toLowerCase();
        // The search string used in the subject line.
        String s = 'unsubscribe';
         
        // Check the variable to see if the word "unsubscribe" was found in the subject line. 
        Boolean unsubMe;
        // Look for the word "unsubcribe" in the subject line. 
        // If it is found, return true; otherwise, return false.
        unsubMe = mySubject.contains(s);
         
         // If unsubscribe is found in the subject line, enter the IF statement.
         
        if (unsubMe == true) {
            
            try {
               
            // Look up all contacts with a matching email address.
               
            for (Contact c : [SELECT Id, Name, Email, HasOptedOutOfEmail
                          FROM Contact
                          WHERE Email = :env.fromAddress
                          AND hasOptedOutOfEmail = false
                          LIMIT 100]) {
                          
                // Add all the matching contacts into the list.   
                c.hasOptedOutOfEmail = true;
                lc.add(c);
            }
            // Update all of the contact records.
            update lc;
        }
        catch (System.QueryException e) {
            System.debug('Contact Query Issue: ' + e);
        }   
        
        try {
            // Look up all leads matching the email address.
            for (Lead l : [SELECT Id, Name, Email, HasOptedOutOfEmail
                     FROM Lead
                     WHERE Email = :env.fromAddress
                     AND isConverted = false
                     AND hasOptedOutOfEmail = false
                     LIMIT 100]) {
                // Add all the leads to the list.       
                l.hasOptedOutOfEmail = true;
                ll.add(l);
                   
                System.debug('Lead Object: ' + l);   
            } 
            // Update all lead records in the query.
            update ll;
        }
        
        catch (System.QueryException e) {
            System.debug('Lead Query Issue: ' + e);
        }   
        
        System.debug('Found the unsubscribe word in the subject line.');
         } 
         else {
            System.debug('No Unsuscribe word found in the subject line.' );
         }
        // Return True and exit.
        // True confirms program is complete and no emails 
        // should be sent to the sender of the unsubscribe request. 
        result.success = true;
        return result;
    }   
}

thanks,
Sascha
HI,

If I click on the button the parameter calc_view should set to value 1.
But the value is still 0.

Please help me.
 
<apex:commandButton value="CALC" onclick="window.open('/apex/calc_test','_blank','height=500,width=500,toolbar=no,scrollbars=no,resizeable=no,menubar=no,top=200,left=200'); return false;">
	<apex:param name="TEST" value="1" assignTo="{!calc_view}"/>
</apex:commandButton>
 
public class calc_class {

    public Integer calc_VIEW {get; set;}
    
    public Double value1 {get; set;}
    public Double value2 {get; set;}
    
    public calc_class() {
        calc_VIEW = 0;
    }
	
    
    public PageReference Pr_calc() {
        value2= value1/ 3.35 * 100;
        return new PageReference('/apex/calc_test');   
    }

}
Thanks,
Sascha
 
Dear All,

I have the following code and I want to show the value at the top of the bars.
Could you help me.
 
<apex:page controller="Samplepage_class" sidebar="true"> 
    
<apex:includeScript id="a" value="https://www.google.com/jsapi" />

<apex:pageblock title="Samplepage">

<div id="chart_div"></div>
        
<script type="text/javascript">

google.load('visualization', '1.1', {'packages': ['bar']});

google.setOnLoadCallback(drawStuff);

function drawStuff() {
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Team');
    data.addColumn('number', 'Level 1');
    data.addColumn('number', 'Level 2');
    data.addColumn('number', 'Level 3');
    data.addColumn('number', 'Level 4');
    data.addColumn('number', 'YTD');    
    data.addRows([
        ['Team1',  {!Level1_Team1}, {!Level2_Team1}, {!Level3_Team1}, {!Level4_Team1}, {!YTD_Team1}],
        ['Team2',  {!Level1_Team2}, {!Level2_Team2}, {!Level3_Team2}, {!Level4_Team2}, {!YTD_Team2}],
    ]);

    // Set chart options
    var options = {
        isStacked: true,
        width: 850,
        height: 500,
        backgroundColor: '#F8F8F8',
        
        chartArea: { backgroundColor: '#F8F8F8' },

        chart: {
<!--            title: 'SamplePage', -->
            subtitle: 'SampleSubTitle'
        },        
        vAxis: {
            format: 'decimal',
            viewWindow: {
                min: 0,
                max: 15000000
            }
        },
        series: {
            4: { targetAxisIndex: 1 }, 
            5: { targetAxisIndex: 1 }
        }
    };

    var chart = new google.charts.Bar(document.getElementById('chart_div'));
    chart.draw(data, google.charts.Bar.convertOptions(options));
};   

</script>

</apex:pageblock>

</apex:page>
Thanks,
Sascha
Hi,

I like to add the information 'Kon' to the custom object 'Stats__c' if I call the visualforce page.
But I get the error: DML currently not allowed.

Could you help me.


Thanks,
Sascha
 
public class Stats_class {

public Stats_class() {

Stats__c sta = new Site__c();
sta.Site__c = 'Kon';
INSERT sta;

}

}
 
<apex:page controller="Stats_class">

Stats

</apex:page>

 
Hi,

I tried to change the desgin to the tab view and I add the following code.
But now the help text icon is avaiable but the mouse over doesn't work anymore.
And the inline edit is also not possible.

Can I change the code to use the above mentioned functions?
 
<apex:page standardController="Account" showHeader="true" 
      tabStyle="account" >
   <style>
      .activeTab {background-color: #236FBD; color:white; 
         background-image:none}
      .inactiveTab { background-color: lightgrey; color:black; 
         background-image:none}
   </style>
   <apex:tabPanel switchType="client" selectedTab="tabdetails" 
                  id="AccountTabPanel" tabClass="activeTab" 
                  inactiveTabClass="inactiveTab">   
      <apex:tab label="Details" name="AccDetails" id="tabdetails">
         <apex:detail relatedList="false" title="true"/>
      </apex:tab>
      <apex:tab label="Contacts" name="Contacts" id="tabContact">
         <apex:relatedList subject="{!account}" list="contacts" />
      </apex:tab>
      <apex:tab label="Opportunities" name="Opportunities" 
                id="tabOpp">
         <apex:relatedList subject="{!account}" 
                           list="opportunities" />
      </apex:tab>
      <apex:tab label="Open Activities" name="OpenActivities" 
                id="tabOpenAct">
         <apex:relatedList subject="{!account}" 
                           list="OpenActivities" />
      </apex:tab>
      <apex:tab label="Notes and Attachments" 
                name="NotesAndAttachments" id="tabNoteAtt">
         <apex:relatedList subject="{!account}" 
                           list="CombinedAttachments" />
      </apex:tab>
   </apex:tabPanel>
</apex:page>

Thanks,
Sascha
Hi,

If I try to save the apex code, I get the error Unknown property 'Integer.Amount'
Could you help me to fix the problem.

Thanks,
Sascha
 
<apex:page controller="VTPTeam7_class">

<apex:form >

<apex:pageblock >
    <apex:pageBlockButtons location="top" >
        <apex:commandButton action="{!myAnalyze2}" value="Search" id="SearchButton" style="align:center"/>      
    </apex:pageBlockButtons>         
    <table border="1">
        <tr>
            <td>Target Name</td>
            <apex:repeat value="{!RTypeList}" var="RL">
            <td>
                <apex:outputfield value="{!RL.Name}"/>
            </td>
            </apex:repeat>
        </tr>
        <apex:repeat value="{!ValueList}" var="VL1">
        <tr>
            <td>
                <apex:outputField value="{!VL1.Owner.Name}"/>
            </td>
            <apex:repeat value="{!Summaries}" var="VL2">
            <td>
                {!VL2.Amount}
            </td>
            </apex:repeat>               
        </tr>
        </apex:repeat>
    </table>         
</apex:pageblock>

</apex:form>

</apex:page>
 
Public Class VTPTeam7_class {

Public List <RecordType> RTypeList {get; set;}
Public List <User> UserList {get; set;}
Public List <Opportunity> ValueList {get; set;}
Public List <Integer> Summaries {get; set;}

Public VTPTeam7_class() {

}

Public void myAnalyze2() {

    RTypeList = [SELECT Id, Name FROM RecordType WHERE SobjectType = 'Opportunity'];
    UserList = [SELECT Id, Name FROM User WHERE Team__c = 'Team Bayern'];
    
    List <Integer> Summaries = new List <Integer>();
    
    FOR (User UserName : [SELECT Id, Name FROM User WHERE Team__c = 'Team Bayern']) {
        FOR (RecordType RType : [SELECT Id, Name FROM RecordType WHERE SobjectType = 'Opportunity']) {
            ValueList = [SELECT Owner.Id, Owner.Name, RecordType.Id, Amount FROM Opportunity WHERE Owner.Id = :UserList AND RecordType.Id = :RTypeList];           
                IF (ValueList.size()==0) {
                    Summaries.Add(0);
                }
                ELSE {
                    Summaries.Add(1);
                }
        }
   }
}

}

 

Hi All,

This is the VF page code to disply google map for single Account (billing address)it is working. like this i want to display all the account on Google map. Can anyone please tell how to resolve this issue.Also tell what is the change i need to do for this.  

 

VF Code:

 

<apex:page standardController="Account" >
<apex:pageBlock >
<head>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {

var myOptions = {
zoom: 20,
mapTypeId: google.maps.MapTypeId.HYBRID,
mapTypeControl: true
}

var map;
var marker;

var geocoder = new google.maps.Geocoder();
var address = "{!Account.BillingStreet}, {!Account.BillingPostalCode} {!Account.BillingCity}, {!Account.BillingState}, {!Account.BillingCountry}";



var infowindow = new google.maps.InfoWindow({
content: "<b>{!Account.Name}</b>"
});

geocoder.geocode( { address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results.length) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {

//create map
map = new google.maps.Map(document.getElementById("map"), myOptions);

//center map
map.setCenter(results[0].geometry.location);

//create marker
marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title: "{!Account.Name}"
});

//add listeners
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
google.maps.event.addListener(infowindow, 'closeclick', function() {
map.setCenter(marker.getPosition());
});

}

} else {
$('#map').css({'height' : '15px'});
$('#map').html("Oops! {!Account.Name}'s address could not be found, please make sure the address is correct.");
resizeIframe();
}
});

function resizeIframe() {
var me = window.name;
if (me) {
var iframes = parent.document.getElementsByName(me);
if (iframes && iframes.length == 1) {
height = document.body.offsetHeight;
iframes[0].style.height = height + "px";
}
}
}

});
</script>

<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:500px;
background:transparent;
}
</style>

</head>

<body>
<div id="map"></div>
</body>
</apex:pageBlock>
</apex:page>

 

Regards,

Udaya