• Matthias Kimmig
  • NEWBIE
  • 30 Points
  • Member since 2014

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

I hava create a button in a custom object which execute a apex-class.
This apex-class create a contact and a opportunity with the information from the custom object.

It works fine. Now, I would like to throw exceptions and display the error messages on a popup.

How can I do this?

Regards,
Matthias
Hi,

I would like to initiate a List<Account> with the result of a SOQL querry. But it doesn't works.

global class UebermittlungBestellungAccount{
    
    static Boolean checkAccountId(String accountId){
        
        List<Account> acc = new List<Account>();
        Boolean check;
    	String aId;
        
        acc = [SELECT Name, Id FROM Account WHERE Id = :accountId];
        aId = acc.get(0).Id;

        If(aId==accountId){
            check=true;
        }else{
            check=false;
        }
        return check;
    }
}
Could you help me?
thanks

Regards,
Matthias

Hi,

I have created a custom object. I have called it order. This order can be create directly by the customer on a Visualforce page.
In this object, it should to display the related list for price books and products. The related list should be the same as in the opportunity.

How can I define a related list called "product" that looks just like the products in the Opportunity view?

Regards,
Matthias
Hi,

I want to create an invoice automatically. The information for this invoice come from the opportunity. The procedure should also work for several invoices.

My questions are:

1 How should I start this project best?
2 Can I use the MS Word templates or do I need another format for the template for example HTML, CSS ...?
3 How can I convert the invoice to a Pdf?
4 How can I send this invoice to the contact per e-mail?

Thanks.

Regards,
Matthias
5 How can I save the invoice in the opportunity as an investment?
Hey,

I have created the following Apex class and the Visualforce page:

Apex-Class:

public class MailOppController{

    public List<OpportunityContactRole>cRole{get; set;}
    public List<OpportunityContactRole>pRole{get; set;}
    public String oppID;

    public MailOppController(ApexPages.StandardController controller){

        Opportunity currentobject = (Opportunity) controller.getRecord();
        oppID = currentobject.Id;
        
        cRole = [SELECT ContactId, OpportunityId, IsPrimary FROM OpportunityContactRole WHERE OpportunityId = :oppID AND IsPrimary=false];
		pRole = [SELECT ContactId, OpportunityId, IsPrimary FROM OpportunityContactRole WHERE OpportunityId = :oppID AND IsPrimary=true];
    }
    
    public String getCarbonCopy(){
        
        String carbonCopy;       
        
        for (Integer i=0; i<crole.size();i++) {
            
            Contact mail_temp = [SELECT Email FROM Contact WHERE Id = :cRole.get(i).ContactId];
            
            if(i==0){
                carbonCopy = mail_temp.Email;
            } else {
            	carbonCopy = carbonCopy +', '+ mail_temp.Email;
            }
    	}
        return carbonCopy;
    }
    
    public String getPrimary(){
        
        String primary;       
        
		Contact mail_temp = [SELECT Email FROM Contact WHERE Id = :pRole.get(0).ContactId];
        primary = mail_temp.Email;
        
        return primary;
    }
}

VisualForce Page
<apex:page standardController="Opportunity" extensions="MailOppController" tabStyle="Opportunity"> 
    <apex:outputLink value="https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&source=mailto&to={!primary}&cc={!carbonCopy}" target="_blank" id="theLink">GMail</apex:outputLink>   
</apex:page>

The link in the Visualforce page should be immediately executed when the user clicks on the button. How can I implement it?
It is important that the parameters of the Apex class passed the link previously.

Regards,
Matthias
Hey,

I would like to define a button in the opportunity which opens a GMail window (Mailto). The recipient of this mail should be the primary contact of the opportunity. At the same time, all other contacts of the opportunity should get the mail as a carbon copy. It is important that this happens automatically.

How can I accomplish that?

Regards,
Matthias
Hey,

I would like to display the telephone number of the primary contact in the opportunity. I tried to apply a custom field in SF. That did not work.

Now, I would like to define a field wich show me the telephone number. How can I define a field with apex or a visualeforce page?

The SOQL code is:
SELECT Contact.HomePhone FROM OpportunityContactRole WHERE IsPrimary = true

thanks for your answer.
Hey,

this is my first visualforce page.

I have one question concerning Apex class. How can I pass a value to the Apex class from the current Visualforce page/Opportunity? For example, the zip code?

In Germany, the postal code consists of 5 digits. But I want to pass only the first 3 digits to the Apex class. How does it work?

Visualfoce page:
<apex:page standardController="Opportunity" extensions="Controller" tabStyle="Opportunity">
    <apex:pageBlock title="zip code">
        <apex:pageBlockTable value="{!opp}" var="Opportunity" >
            <apex:column value="{!Opportunity.AccountId}"/>
            <apex:column value="{!Opportunity.City__c}"/>
            <apex:column value="{!Opportunity.Zip_Code__c}"/>
            <apex:column headerValue="Link">
                <apex:outputLink value="{!'/'&Opportunity.AccountId}">Link</apex:outputLink>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

Apex-Class:
public class Controller {

    public List<Opportunity>opp{get; set;}
  
    public Controller(ApexPages.StandardController controller){
      
        opp = [SELECT Zip_Code__c, Stadt__c, AccountId FROM Opportunity WHERE Zip_Code__c LIKE :LEFT(currentobject.zip_Code__c,3);
    }
}

This command ":LEFT(currentobject.zip_Code__c,3)" does not work. What is the correct command?

Thanks for your answers.
Hi,

I would like to initiate a List<Account> with the result of a SOQL querry. But it doesn't works.

global class UebermittlungBestellungAccount{
    
    static Boolean checkAccountId(String accountId){
        
        List<Account> acc = new List<Account>();
        Boolean check;
    	String aId;
        
        acc = [SELECT Name, Id FROM Account WHERE Id = :accountId];
        aId = acc.get(0).Id;

        If(aId==accountId){
            check=true;
        }else{
            check=false;
        }
        return check;
    }
}
Could you help me?
thanks

Regards,
Matthias

Hi,

I want to create an invoice automatically. The information for this invoice come from the opportunity. The procedure should also work for several invoices.

My questions are:

1 How should I start this project best?
2 Can I use the MS Word templates or do I need another format for the template for example HTML, CSS ...?
3 How can I convert the invoice to a Pdf?
4 How can I send this invoice to the contact per e-mail?

Thanks.

Regards,
Matthias
5 How can I save the invoice in the opportunity as an investment?
Hey,

I have created the following Apex class and the Visualforce page:

Apex-Class:

public class MailOppController{

    public List<OpportunityContactRole>cRole{get; set;}
    public List<OpportunityContactRole>pRole{get; set;}
    public String oppID;

    public MailOppController(ApexPages.StandardController controller){

        Opportunity currentobject = (Opportunity) controller.getRecord();
        oppID = currentobject.Id;
        
        cRole = [SELECT ContactId, OpportunityId, IsPrimary FROM OpportunityContactRole WHERE OpportunityId = :oppID AND IsPrimary=false];
		pRole = [SELECT ContactId, OpportunityId, IsPrimary FROM OpportunityContactRole WHERE OpportunityId = :oppID AND IsPrimary=true];
    }
    
    public String getCarbonCopy(){
        
        String carbonCopy;       
        
        for (Integer i=0; i<crole.size();i++) {
            
            Contact mail_temp = [SELECT Email FROM Contact WHERE Id = :cRole.get(i).ContactId];
            
            if(i==0){
                carbonCopy = mail_temp.Email;
            } else {
            	carbonCopy = carbonCopy +', '+ mail_temp.Email;
            }
    	}
        return carbonCopy;
    }
    
    public String getPrimary(){
        
        String primary;       
        
		Contact mail_temp = [SELECT Email FROM Contact WHERE Id = :pRole.get(0).ContactId];
        primary = mail_temp.Email;
        
        return primary;
    }
}

VisualForce Page
<apex:page standardController="Opportunity" extensions="MailOppController" tabStyle="Opportunity"> 
    <apex:outputLink value="https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&source=mailto&to={!primary}&cc={!carbonCopy}" target="_blank" id="theLink">GMail</apex:outputLink>   
</apex:page>

The link in the Visualforce page should be immediately executed when the user clicks on the button. How can I implement it?
It is important that the parameters of the Apex class passed the link previously.

Regards,
Matthias
Hey,

I would like to define a button in the opportunity which opens a GMail window (Mailto). The recipient of this mail should be the primary contact of the opportunity. At the same time, all other contacts of the opportunity should get the mail as a carbon copy. It is important that this happens automatically.

How can I accomplish that?

Regards,
Matthias
Hey,

this is my first visualforce page.

I have one question concerning Apex class. How can I pass a value to the Apex class from the current Visualforce page/Opportunity? For example, the zip code?

In Germany, the postal code consists of 5 digits. But I want to pass only the first 3 digits to the Apex class. How does it work?

Visualfoce page:
<apex:page standardController="Opportunity" extensions="Controller" tabStyle="Opportunity">
    <apex:pageBlock title="zip code">
        <apex:pageBlockTable value="{!opp}" var="Opportunity" >
            <apex:column value="{!Opportunity.AccountId}"/>
            <apex:column value="{!Opportunity.City__c}"/>
            <apex:column value="{!Opportunity.Zip_Code__c}"/>
            <apex:column headerValue="Link">
                <apex:outputLink value="{!'/'&Opportunity.AccountId}">Link</apex:outputLink>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

Apex-Class:
public class Controller {

    public List<Opportunity>opp{get; set;}
  
    public Controller(ApexPages.StandardController controller){
      
        opp = [SELECT Zip_Code__c, Stadt__c, AccountId FROM Opportunity WHERE Zip_Code__c LIKE :LEFT(currentobject.zip_Code__c,3);
    }
}

This command ":LEFT(currentobject.zip_Code__c,3)" does not work. What is the correct command?

Thanks for your answers.