• aalazzani
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 4
    Replies

I am trying to add a a custom HTML components that show up in the sidebar of all pages (not only home page). What are the best alternatives. Sample code will be appreciated.

 

Aref

I want to create a CLI configuration of Data Loader. Everything works fine except that we want to handle errors in two different ways.

1- For operational errors such as login error, network errors, proxy errors, we want an email notification to be sent to the System Admin.
2- For Data Errors, such as Insert or Update errors, we want to send an email to the record owner. Also we have some acceptable error for which we don't need to send emails, so we want to exclude them from the notification.
So here are my questions,

1- I changed the log-conf.xml file to include SMTP Appender but the problem is that both types of errors above have the same log4j level "ERROR" so I cannot distinguish between the two to create different SMTP Appender for each. How can I achieve that using log4j configuration.
2- Is it possible in After Insert, After Update triggers to access the transaction results? I am thinking of creating a trigger that check these errors, process them and notify owner with them.
3- Is there any better way to do that? I will appreciate any suggestions.

Thanks in advance.
Aref
I want to create a CLI configuration of Data Loader. Everything works fine except that we want to handle errors in two different ways.

1- For operational errors such as login error, network errors, proxy errors, we want an email notification to be sent to the System Admin.
2- For Data Errors, such as Insert or Update errors, we want to send an email to the record owner. Also we have some acceptable error for which we don't need to send emails, so we want to exclude them from the notification.
So here are my questions,

1- I changed the log-conf.xml file to include SMTP Appender but the problem is that both types of errors above have the same log4j level "ERROR" so I cannot distinguish between the two to create different SMTP Appender for each. How can I achieve that using log4j configuration.
2- Is it possible in After Insert, After Update triggers to access the transaction results? I am thinking of creating a trigger that check these errors, process them and notify owner with them.
3- Is there any better way to do that? I will appreciate any suggestions.

Thanks in advance.
Aref

I am writing a query in an Apex Code method and I want to make sure that there is at least one element retrieved before I start accessing elements by index. I tried .length, .count, .length() but none gave me how many elements were retrieved by the query. How can I determine if any elements were retrieved by the query? Here is my code below and thanks in advance for your help.

Thanks,

Aref

Code:
LeadAssignment__c[] defaultLeadAssignments = [Select User__c from LeadAssignment__c where Name = '00000'];

if(defaultLeadAssignments.length > 0){
 defaultUser  = defaultLeadAssignments[0].User__c ; 
}

Message Edited by aalazzani on 11-16-2007 12:27 AM

Message Edited by aalazzani on 11-16-2007 12:29 AM

Message Edited by aalazzani on 11-16-2007 12:30 AM

I am getting this error when I try to run the code below. Please help.

Error:

System.Web.Services.Protocols.SoapHeaderException was unhandled
  Message="A duplicate value was specified for field 'Id' in object 'Opportunity', duplicate value '00650000008ov0VAAQ' prior value '00650000008ov0VAAQ'"

_______________________________________________________________________________ 

Code:

 

sObject[] myOppties;

myOppties = sfdc.retrieve("Id, AccountId", "Opportunity", new String[] { "00650000008ov0VAAQ", "00650000008mpS4AAI", "00650000008m20QAAQ" });

for (int i = 0; i < myOppties.Length;i++)

{

if (myOppties[i].Any[0].InnerText == "00650000008m20QAAQ")

{

myOppties[i].Any[1].InnerText = "0015000000IRt4nAAD";

}

System.Console.WriteLine(myOppties[i].Any[0].InnerText + " " + myOppties[i].Any[1].InnerText);

}

SaveResult[] mySaveResult = sfdc.update(myOppties);

Hi All,

I am overriding the "Add Product" button and I am constructing the "Product Selection table". To do that I used the markup and custom controller getter and setter below. I also created a class that represent a PricebookEntry record along with a checkbox element. The getter works fine but my setter is never called when the user click the "select" button. I need the setter to parse returned result to know which Products were selected and update the class List for selected Price book entries. This is very time critical issue so I will really appreciate prompt help.

Thanks,

Aref

Code:
<apex:form >  
  <apex:outputPanel id="ProductsTable">    
   <apex:pageblock > 
    <apex:pageBlockButtons >
     <apex:commandButton action="{!selectProducts}" value="Select"/>
     <apex:commandButton action="{!cancelSelection}" value="Cancel"/>
    </apex:pageBlockButtons>       
    <apex:pageBlockTable value="{!pricebookEntries}" var="pricebookEntry" >       
     <apex:column >    
      <apex:facet name="header"></apex:facet>                 
           <apex:inputCheckbox value="{!pricebookEntry.pbeIsSelected}"/> 
          </apex:column>
        <apex:column >
           <apex:facet name="header">{!$ObjectType.Product2.fields.name.label}</apex:facet>  
           <a href="/{!pricebookEntry.pbeProduct2Id}">       
            {!pricebookEntry.pbeName}
           </a>           
         </apex:column>
         <apex:column >
           <apex:facet name="header">{!$ObjectType.pricebookEntry.fields.ProductCode.label}</apex:facet>          
           <apex:outputText value="{!pricebookEntry.pbeProductCode}"/>           
         </apex:column>
         <apex:column >
           <apex:facet name="header">{!$ObjectType.pricebookEntry.fields.UnitPrice.label}</apex:facet>          
           <apex:outputText value="{!pricebookEntry.pbeUnitPrice}"/>           
         </apex:column>
         <apex:column >
           <apex:facet name="header">{!$ObjectType.Product2.fields.Description.label}</apex:facet>          
           <apex:outputText value="{!pricebookEntry.pbeProductDescription}"/>           
         </apex:column>               
      </apex:pageBlockTable>           
     </apex:pageblock> 
    </apex:outputPanel>      
 </apex:form>  

 and thid controller getter and setter:

Code:
 //-----------------------------------------
 //OverrideAddProduct Page
 //Accessor Methods for <apex:pageBlockTable value="{!pricebookEntries}" var="pricebookEntry" > control
    
    public List<PricebookEntryUIElement> getPricebookEntries() 
    {   
     List<PricebookEntryUIElement> pricebookEntryUIElements = new List<PricebookEntryUIElement>();
       
        List<PricebookEntry> pricebookEntries = [Select Id, IsActive, Name, Pricebook2Id, Product2Id, 
Product2.Description, Product2.Family, ProductCode, UnitPrice
from PricebookEntry where IsActive = true and Product2.Family = :productFamily]; for(PricebookEntry pricebookEntry: pricebookEntries){ PricebookEntryUIElement pricebookEntryUIElement = new PricebookEntryUIElement(); pricebookEntryUIElement.setPbeIsSelected(false); pricebookEntryUIElement.setPbeId(pricebookEntry.Id); pricebookEntryUIElement.setPbeName(pricebookEntry.Name); pricebookEntryUIElement.setPbePricebook2Id(pricebookEntry.Pricebook2Id); pricebookEntryUIElement.setPbeProduct2Id(pricebookEntry.Product2Id); pricebookEntryUIElement.setPbeProductDescription(pricebookEntry.Product2.Description); pricebookEntryUIElement.setPbeProductFamily(pricebookEntry.Product2.Family); pricebookEntryUIElement.setPbeProductCode(pricebookEntry.ProductCode); pricebookEntryUIElement.setPbeUnitPrice(pricebookEntry.UnitPrice); pricebookEntryUIElements.add(pricebookEntryUIElement); } return pricebookEntryUIElements; } public void setPricebookEntries(List<PricebookEntryUIElement> pricebookEntryUIElements) { System.debug('setPricebookEntries visited'); this.selectedPricebookEntries = new List<PricebookEntryUIElement>(); for(PricebookEntryUIElement pricebookEntryUIElement:pricebookEntryUIElements){ if(pricebookEntryUIElement.getPbeIsSelected()){ this.selectedPricebookEntries.add(pricebookEntryUIElement); } } }

 




Message Edited by azzani on 07-08-2008 01:52 AM

Message Edited by azzani on 07-08-2008 01:55 AM
I am writing a query in an Apex Code method and I want to make sure that there is at least one element retrieved before I start accessing elements by index. I tried .length, .count, .length() but none gave me how many elements were retrieved by the query. How can I determine if any elements were retrieved by the query? Here is my code below and thanks in advance for your help.

Thanks,

Aref

Code:
LeadAssignment__c[] defaultLeadAssignments = [Select User__c from LeadAssignment__c where Name = '00000'];

if(defaultLeadAssignments.length > 0){
 defaultUser  = defaultLeadAssignments[0].User__c ; 
}

Message Edited by aalazzani on 11-16-2007 12:27 AM

Message Edited by aalazzani on 11-16-2007 12:29 AM

Message Edited by aalazzani on 11-16-2007 12:30 AM

I am getting this error when I try to run the code below. Please help.

Error:

System.Web.Services.Protocols.SoapHeaderException was unhandled
  Message="A duplicate value was specified for field 'Id' in object 'Opportunity', duplicate value '00650000008ov0VAAQ' prior value '00650000008ov0VAAQ'"

_______________________________________________________________________________ 

Code:

 

sObject[] myOppties;

myOppties = sfdc.retrieve("Id, AccountId", "Opportunity", new String[] { "00650000008ov0VAAQ", "00650000008mpS4AAI", "00650000008m20QAAQ" });

for (int i = 0; i < myOppties.Length;i++)

{

if (myOppties[i].Any[0].InnerText == "00650000008m20QAAQ")

{

myOppties[i].Any[1].InnerText = "0015000000IRt4nAAD";

}

System.Console.WriteLine(myOppties[i].Any[0].InnerText + " " + myOppties[i].Any[1].InnerText);

}

SaveResult[] mySaveResult = sfdc.update(myOppties);