• ledap13
  • NEWBIE
  • 30 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 26
    Questions
  • 38
    Replies
Hi,
i have a Problem. My Button dont fired.
When I turn on the console.log(amt) after amtField.get("Value") nothing happens. Why?
The calendar will not open. Why?

thanks
 
Hi friends,
please help me. What is wrong with the code?

listProduct2 = [SELECT id, name, tariff__c from product2 where tariff__c =: tariffChosen];
        for (product2 prod : listProduct2) {
            List<OpportunityLineItem> listOpportunityLineItem = new List<OpportunityLineItem>();
           System.debug('The products : '+prod);
            OpportunityLineItem oppliToInsert = new OpportunityLineItem(
                OpportunityId = myOpportunity.Id,
                Product2Id = prod.id);  // ?????????????
   listOpportunityLineItem.add(oppliToInsert);
         }
Hello,
how can i update the products on my opportunity?


Thanks
Hi friends,
how can I return a value in a controller from my page?

Thanks
Here is my code:

public void selectProductsByTariff(){
       
        system.debug( 'Start ' +  myOpportunity.Id );
      tariffName = System.currentPageReference().getParameters().get('Tariff');
        system.debug( 'Tariff: ' +tariffname);
        listTariff_Bundles = [SELECT Name, (SELECT Id, Name, Product__c FROM Product2Tariff__r) from Tariff_Bundles__c WHERE Name = :tariffname LIMIT 1];
        for (Tariff_Bundles__c master : listTariff_Bundles) {
           System.debug('Here is an ObjectMaster record: '+master);
          for (Product2Tariff__c detail : master.Product2Tariff__r) {
              object productId = detail.get('Id');
              myProduct = [SELECT Id, Name from Product2 where Id = :productId];  (invalid bind expression type of object for column of type Id)
                           
            System.debug('Here is an ObjectDetail record: '+productName);
          }
        }
    }


Please help me!!
Hi friends,
I have the following problem:
I want to return the value of my field in my controller.

<apex:inputField value="{!Opportunity.Tariff__c}" >
  <apex:actionSupport event="onchange" action="{!selectProductsByTariff}" />
</apex:inputfield>

where tariff_c a Lookup Relationship to a custom object.

Thanks
Hello,
how can I create a pdf with a template in a trigger?
Please help me
Hi friends,
how can generate a pdf in my quote-trigger?
Hi friends,
I have a problem with my SOQL query.
Why can I not query the AccountId like this?

public Id idAcc {get;set;}
            .
            .
idAcc = [SELECT AccountId FROM Opportunity WHERE ID = :quo.OpportunityId LIMIT 1];



But with the following string is correct

Opportunity Opp = [SELECT AccountId FROM Opportunity WHERE ID = :quo.OpportunityId LIMIT 1];
Hi ..
I have a master-detail relationship to my object Order__c and account.
When I ausführe my query:
List <AggregateResult> result = [SELECT Account__c, COUNT (name), SUM (Price__c) total FROM Order__c GROUP BY Account__c];

How do I get through the Account__c field returns the name of the account?
Hello,

as I can in a batch job values ​​of the execute method after the finish line method of giving?
Hi,
my custom field Restaurant__c is defined as a picklist.
I want to read the values ​​of the list in my  execute part of my code.
how does the best?


global Database.QueryLocator start(Database.BatchableContext BC)
    {
        Date d = Date.today();
        String query = 'SELECT Account__c,Lieferkosten__c,Preis__c,Restaurant__c,Kunde__c FROM Order__c WHERE DatumZeit__c < :d';
        return Database.getQueryLocator(query);
    }

global void execute(Database.BatchableContext BC, List<Sobject> scope)
    {    .....
    
I want a cyclic evaluation of my custom object order to the price, tax, etc.
For this I need to query some 10000 records and calculate.
Which way is better? Creating a class or batch job?
Is there a bestpractice?
What is there to create a summary for options.
For example:
I want to capture all of my monthly Opportunity and create a PDF.
Hi,
how can I create a PDF for a custom object, similar to Quote?

Thanks
Hello friends,

I want to create a timed event, with whom I can call a apex class.
The period can range from daily to monthly.

Thanks

Hi Friends,

 

what 's wrong?

 

Error:

 

Error: Compile Error: Invalid initial expression type for field Contract.AccountId, expecting: Id at line 9 column 42

 

Trigger

 

trigger QuoteTrigger on Quote(after update){
private string tagoppid {get;set;}
    for(Quote quo : trigger.new){
        if(trigger.isUpdate){
            if(quo.Status== 'Accepted' && quo.Status!= trigger.oldMap.get(quo.Id).Status){
                tagoppid = quo.OpportunityId;
                //create a contract
                contract[] newcontract = new List<contract>{
                new contract(AccountID = [select AccountID from Opportunity where Id = :tagoppid ],
                             //AccountID = quo.OpportunityId,
                             CustomerSigned = quo.Contact,
                             Name = 'Test 1',   
                             CustomerSignedTitle = quo.Name,
                             StartDate = System.today(),
                             ContractTerm = 6)};
                
                //SaveResult[] results = binding.create(new sObject[] {newcontract });
                Database.SaveResult[] srList = Database.insert(newcontract, false);
                
                // Iterate through each returned result
                for (Database.SaveResult sr : srList) {
                    if (sr.isSuccess()) {
                        // Operation was successful, so get the ID of the record that was processed
                        System.debug('Successfully inserted account. Account ID: ' + sr.getId());
                    }
                    else {
                        // Operation failed, so get all errors                
                        for(Database.Error err : sr.getErrors()) {
                            System.debug('The following error has occurred.');                    
                            System.debug(err.getStatusCode() + ': ' + err.getMessage());
                            System.debug('Account fields that affected this error: ' + err.getFields());
                        }
                    }
                }
        }
    }
}
}

Hi Friends,

 

how can look like a trigger that fires in the Object Opportunity on the field Probability = 100%???

 

 

Thanks

Hi Friends,

 

can someone help me?

 

My controller:

public class contactExtension {
    private final Contact c; //User sobject
    private Opportunity oneopp {get;set;}
    public OpportunityContactRole  Oneoppid {get;set;}
    public List<cOpportunity> listOpportunity {get;set;}
    public List<Quote> listQuotes {get;set;}    
    public string optionacc{get;set;}
    public string optioncon{get;set;}
    public string optionquo{get;set;}      
    public string optionquoName{get;set;}      
    private string accountid {get;set;}
    Boolean showSecvar = false;
    Boolean showListvar = false;
    
    //initializes the private member variable u by using the getRecord method from the standard controller
    public contactExtension(ApexPages.StandardController stdController) {
        this.c = (Contact)stdController.getRecord();
    }
    

    public List<selectOption> getaccts() {
        List<selectOption> accts = new List<selectOption>();
            accts.add(new selectOption('', '- None -'));
            for (Account account : [SELECT Id, Name FROM Account]) {
            accts.add(new selectOption(account.id, account.Name));
        }
        return accts;
    }
    
    public List<selectOption> getconts() {
        List<selectOption> conts = new List<selectOption>();
            conts.add(new selectOption('', '- None -'));
            for (Contact contact : [SELECT Id, Name FROM Contact where accountid = :optionacc]) {
            conts.add(new selectOption(contact.id, contact.Name));
        }
        return conts;
    }     
    
   //select von Auswahlliste Contact
    public pagereference selectionCon(){
        getOpportunity();
        if (listOpportunity.size() >0) {
        showSection();
        }else{ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'No available opportunities!!'));   
        dontshowSection();     
        }
        return null;
    }    

    public pagereference testmessage(){
        processSelected();
        ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Hello World !!'+optionquoName));
        return null;
    }
 
    public List<cOpportunity> getOpportunity() {
          if(listOpportunity == null) {
             listOpportunity = new List<cOpportunity>();
             for(Opportunity c: [SELECT ID,Name,StageName,Probability FROM Opportunity WHERE id in (Select OpportunityId From OpportunityContactRole where ContactId = :optioncon) LIMIT 50000]) {
                  listOpportunity.add(new cOpportunity(c));
             }
          }
          return listOpportunity ;
      }       


     public class cOpportunity {
          public Opportunity opp {get; set;}
          public Boolean selected {get; set;}
   
          //This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false
          public cOpportunity (Opportunity c) {
             opp = c;
             selected = false;
          }
      }
 
    public PageReference processSelected() {
          List<Opportunity> selectedOpportunity = new List<Opportunity>();
          for(cOpportunity cOpp: listOpportunity){
              if(cOpp.selected == true) {
                  selectedOpportunity.add(cOpp.opp);
                  
              }else{
              ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'No Selected !!'));
              }
           }     
           
          showlistqoutes();
          if(listQuotes.size() > 0){
              showinflist();
          }
          
          System.debug('These are the selected Opportunity...');
          for(Opportunity opp: selectedOpportunity) {
              system.debug(opp);
              optionquo = opp.id;
              optionquoName= opp.Name;              
          }
          return null;
      }

        
    public pagereference showlistqoutes(){
        listQuotes = [SELECT QuoteNumber, Name, Discount FROM Quote WHERE OpportunityId=:optionquo LIMIT 50000];
        return null;
    }  
 

    public pageReference saveOpportinities() {
        try {
            List<Opportunity> OpportunityToUpdate = new  List<Opportunity>();
            for(cOpportunity cOpp: listOpportunity ) {
                if(cOpp.Selected) {
                    OpportunityToUpdate.add(cOpp.opp);
                }
            }     
            update OpportunityToUpdate;
        }
        catch(Exception ex) {
        apexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'The value for the field Last Name is already available !!'));
        }
        ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Record saved !!'));        
        return null;
    }    
      
    public void showSection() {showSecvar = true;}
    public Boolean getSectionshow(){return showSecvar;}  

    public void dontshowSection() {showSecvar = false;}
    public Boolean getdontshowSection(){return showSecvar;}     
    
    public void showInfList(){showListvar = true;}
    public Boolean getInfListshow(){return showListvar;}   
    
    public void dontshowInfList(){showListvar = true;}
    public Boolean getdontInfListshow(){return showListvar;}  
}

 

My Page:

 

<apex:page standardController="Contact" extensions="contactExtension" standardStylesheets="true">
<apex:pagemessages />
    <apex:sectionHeader title="Test für Trigger Quotes " subtitle="{!Contact.Name}" help="/help/doc/user_ed.jsp?loc=help"> </apex:sectionHeader>
    <apex:form >
    <apex:actionFunction name="myactionfun"  action="{!testmessage}"/>
        <apex:pageBlock mode="edit">
            <apex:pageBlockSection title="Accounts & Contacts" >
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Account Name" for="acc" />
                    <apex:selectList id="acc" value="{!optionacc}" size="1" title="Account">
                        <apex:selectOptions value="{!accts}"/>
                        <apex:actionSupport event="onchange"/>
                    </apex:selectList>
                </apex:pageBlockSectionItem>
                <br/>
                <apex:pageBlockSectionItem >
                     <apex:outputLabel value="Contact Name" for="acc" />
                    <apex:selectList value="{!optioncon}" size="1" title="Account" >
                        <apex:selectOptions value="{!conts}" />
                        <apex:actionSupport event="onchange" action="{!selectionCon}"/>                         
                    </apex:selectList>
                </apex:pageBlockSectionItem>                   
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Opportunities" rendered="{!sectionshow}" >
                <apex:commandbutton action="{!saveOpportinities}" value="Save"/>
                <br/>
                <apex:dataTable value="{!listOpportunity}" var="item" >
                  <apex:column >
                        <apex:facet name="header">{!$ObjectType.Opportunity.fields.Name.label}</apex:facet>
                        <apex:inputfield value="{!item.opp.Name}"></apex:inputfield>
                    </apex:column><apex:column >    
                        <apex:facet name="header">{!$ObjectType.Opportunity.fields.StageName.label}</apex:facet>                        
                        <apex:inputfield value="{!item.opp.StageName}"></apex:inputfield>
                    </apex:column><apex:column >   
                        <apex:facet name="header">{!$ObjectType.Opportunity.fields.Probability .label}</apex:facet>                         
                        <apex:inputfield value="{!item.opp.Probability }"></apex:inputfield>
                    </apex:column>
                    <apex:column headerValue="Test">
                        <apex:inputCheckbox value="{!item.selected}">
                         <apex:actionSupport event="onchange" action="{!testmessage}" />
                        </apex:inputCheckbox>     
                  </apex:column>           
                </apex:dataTable>                            
            </apex:pageBlockSection>  
            <apex:pageBlockSection title="Quote" rendered="{!InfListshow}" >
                <apex:commandbutton action="{!saveOpportinities}" value="Save"/>
                <br/>
                <apex:dataTable value="{!listQuotes}" var="item" >
                  <apex:column >
                        <apex:facet name="header">{!$ObjectType.Quote.fields.Name.label}</apex:facet>
                        <apex:inputfield value="{!item.Name}"></apex:inputfield>
                    </apex:column><apex:column >    
                        <apex:facet name="header">{!$ObjectType.Quote.fields.QuoteNumber.label}</apex:facet>                        
                        <apex:inputfield value="{!item.QuoteNumber}"></apex:inputfield>
                    </apex:column><apex:column >   
                        <apex:facet name="header">{!$ObjectType.Quote.fields.Discount .label}</apex:facet>                         
                        <apex:inputfield value="{!item.Discount }"></apex:inputfield>
                    </apex:column>
                </apex:dataTable>                            
            </apex:pageBlockSection>             
        </apex:pageBlock>
    </apex:form>
</apex:page>

Hi Friends,

 

can you help me?

 

 

<apex:page standardController="Contact" extensions="contactExtension" standardStylesheets="true">
<apex:pagemessages />
    <apex:sectionHeader title="Test für Trigger Quotes " subtitle="{!Contact.Name}" help="/help/doc/user_ed.jsp?loc=help"> </apex:sectionHeader>
    <apex:form >
        <apex:pageBlock mode="edit">
            <apex:pageBlockSection title="Accounts" >
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Account Name" for="acc" />
                    <apex:selectList id="acc" value="{!optionacc}" size="1" title="Account">
                        <apex:selectOptions value="{!accts}"/>
                        <apex:actionSupport event="onchange" action="{!selectionAcc}"/>   
                    </apex:selectList>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                        <apex:selectList value="{!optioncon}" size="1" title="Account" >
                            <apex:selectOptions value="{!conts}" ></apex:selectOptions>
                        </apex:selectList>
                </apex:pageBlockSectionItem>                   
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Information" >
                <apex:dataTable value="{!listOpportunity}" var="item" >
                    <apex:column >
                        <apex:facet name="header">{!$ObjectType.Opportunity.fields.Name.label}</apex:facet>
                        <apex:inputfield value="{!item.Name} "></apex:inputfield>
                    </apex:column><apex:column >    
                        <apex:facet name="header">{!$ObjectType.Opportunity.fields.StageName.label}</apex:facet>                        
                        <apex:inputfield value="{!item.StageName}"></apex:inputfield>
                    </apex:column><apex:column >   
                        <apex:facet name="header">{!$ObjectType.Opportunity.fields.Probability .label}</apex:facet>                         
                        <apex:inputfield value="{!item.Probability }"></apex:inputfield>
                    </apex:column>
                </apex:dataTable>                            
            </apex:pageBlockSection>  
        </apex:pageBlock>
    </apex:form>
</apex:page>

Hi,
i have a Problem. My Button dont fired.
When I turn on the console.log(amt) after amtField.get("Value") nothing happens. Why?
The calendar will not open. Why?

thanks
 
Hi,

Completed the Expense tracker labs , but encountered following two issues

1. Submit button seems to be non responsive , nothing happens when you click it.
2. Event seems to fire but gives an exception "Internal server error". 

Anyone able to do this without any issues? If so please share code.
Hi friends,
please help me. What is wrong with the code?

listProduct2 = [SELECT id, name, tariff__c from product2 where tariff__c =: tariffChosen];
        for (product2 prod : listProduct2) {
            List<OpportunityLineItem> listOpportunityLineItem = new List<OpportunityLineItem>();
           System.debug('The products : '+prod);
            OpportunityLineItem oppliToInsert = new OpportunityLineItem(
                OpportunityId = myOpportunity.Id,
                Product2Id = prod.id);  // ?????????????
   listOpportunityLineItem.add(oppliToInsert);
         }
Hello,
how can i update the products on my opportunity?


Thanks
Hi friends,
how can I return a value in a controller from my page?

Thanks
Here is my code:

public void selectProductsByTariff(){
       
        system.debug( 'Start ' +  myOpportunity.Id );
      tariffName = System.currentPageReference().getParameters().get('Tariff');
        system.debug( 'Tariff: ' +tariffname);
        listTariff_Bundles = [SELECT Name, (SELECT Id, Name, Product__c FROM Product2Tariff__r) from Tariff_Bundles__c WHERE Name = :tariffname LIMIT 1];
        for (Tariff_Bundles__c master : listTariff_Bundles) {
           System.debug('Here is an ObjectMaster record: '+master);
          for (Product2Tariff__c detail : master.Product2Tariff__r) {
              object productId = detail.get('Id');
              myProduct = [SELECT Id, Name from Product2 where Id = :productId];  (invalid bind expression type of object for column of type Id)
                           
            System.debug('Here is an ObjectDetail record: '+productName);
          }
        }
    }


Please help me!!
Hi friends,
I have the following problem:
I want to return the value of my field in my controller.

<apex:inputField value="{!Opportunity.Tariff__c}" >
  <apex:actionSupport event="onchange" action="{!selectProductsByTariff}" />
</apex:inputfield>

where tariff_c a Lookup Relationship to a custom object.

Thanks
Hello,
how can I create a pdf with a template in a trigger?
Please help me
Hi friends,
how can generate a pdf in my quote-trigger?
Hi ..
I have a master-detail relationship to my object Order__c and account.
When I ausführe my query:
List <AggregateResult> result = [SELECT Account__c, COUNT (name), SUM (Price__c) total FROM Order__c GROUP BY Account__c];

How do I get through the Account__c field returns the name of the account?
Hello,

as I can in a batch job values ​​of the execute method after the finish line method of giving?
Hi,
my custom field Restaurant__c is defined as a picklist.
I want to read the values ​​of the list in my  execute part of my code.
how does the best?


global Database.QueryLocator start(Database.BatchableContext BC)
    {
        Date d = Date.today();
        String query = 'SELECT Account__c,Lieferkosten__c,Preis__c,Restaurant__c,Kunde__c FROM Order__c WHERE DatumZeit__c < :d';
        return Database.getQueryLocator(query);
    }

global void execute(Database.BatchableContext BC, List<Sobject> scope)
    {    .....
    
I want a cyclic evaluation of my custom object order to the price, tax, etc.
For this I need to query some 10000 records and calculate.
Which way is better? Creating a class or batch job?
Is there a bestpractice?
What is there to create a summary for options.
For example:
I want to capture all of my monthly Opportunity and create a PDF.
Hi,
how can I create a PDF for a custom object, similar to Quote?

Thanks
Hello friends,

I want to create a timed event, with whom I can call a apex class.
The period can range from daily to monthly.

Thanks

Hi Friends,

 

what 's wrong?

 

Error:

 

Error: Compile Error: Invalid initial expression type for field Contract.AccountId, expecting: Id at line 9 column 42

 

Trigger

 

trigger QuoteTrigger on Quote(after update){
private string tagoppid {get;set;}
    for(Quote quo : trigger.new){
        if(trigger.isUpdate){
            if(quo.Status== 'Accepted' && quo.Status!= trigger.oldMap.get(quo.Id).Status){
                tagoppid = quo.OpportunityId;
                //create a contract
                contract[] newcontract = new List<contract>{
                new contract(AccountID = [select AccountID from Opportunity where Id = :tagoppid ],
                             //AccountID = quo.OpportunityId,
                             CustomerSigned = quo.Contact,
                             Name = 'Test 1',   
                             CustomerSignedTitle = quo.Name,
                             StartDate = System.today(),
                             ContractTerm = 6)};
                
                //SaveResult[] results = binding.create(new sObject[] {newcontract });
                Database.SaveResult[] srList = Database.insert(newcontract, false);
                
                // Iterate through each returned result
                for (Database.SaveResult sr : srList) {
                    if (sr.isSuccess()) {
                        // Operation was successful, so get the ID of the record that was processed
                        System.debug('Successfully inserted account. Account ID: ' + sr.getId());
                    }
                    else {
                        // Operation failed, so get all errors                
                        for(Database.Error err : sr.getErrors()) {
                            System.debug('The following error has occurred.');                    
                            System.debug(err.getStatusCode() + ': ' + err.getMessage());
                            System.debug('Account fields that affected this error: ' + err.getFields());
                        }
                    }
                }
        }
    }
}
}