• Ragseh
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 3
    Replies
Hi All,
Can any one guide me how to prevent duplicate case creation using Messaging.InboundEmailHandler . 
The business scenario is customer send a mail by removing case thread id from the subject and description of the email and instead of thread id customer put case number on the subject and enquire about the case.
Hi All,

Is possible to use standard NAME field (data type is AutoNumber) as external ID while upserting/updating records using enterprice API.....
 
Hi All,

I have a requirement to create partner user dynamically using information from Account and contact.
I am able to create user but not able to recieve the mail(usually salesforce send out a mail to the newly created user with some link to activate the user).
Does any one have any idea to generate this mail dynamically.

Following is the sample code I used to create user.

        User newUser=new User();
        newUser.LastName=objAccount.Name;
        newUser.Email=objAccount.Dispatch_Email__c;
        newUser.Username=objAccount.Dispatch_Email__c+'.dev2';
        newUser.Alias = 'xydx'+'dev2';
        newUser.TimeZoneSidKey='GMT';
        newUser.LocaleSidKey = 'en_GB';
        newUser.EmailEncodingKey = 'ISO-8859-1';
        newUser.LanguageLocaleKey = 'en_US';
        newUser.ProfileId = '00e11000000Lwab';
        newUser.IsActive = true;
        newUser.communitynickname = objAccount.Name+'dev2';
        newUser.contactid = '0031100000K7CHY';
        insert newUser;

Thanks
  • April 23, 2014
  • Like
  • 0

Has anyone worked with salesforce touch for iPod.If so please share your experiance and the merits and demerits of using salesforce touch.

  • September 07, 2012
  • Like
  • 0
Any thoughts on instantly pushing Salesforce data changes to an MDM system?  Almost all objects in Salesforce are in my MDM system. And all of them need to be synced live onto MDM, as any change occurs. What API and integration pattern is best suited?
Hi Guys
I have created a class for searching record .after searching record i need to export that record in excel format.i mean i need one export button ,on click of that button its automatically download that record in excel format
<apex:page docType="html-5.0" standardController="MasterCopy__c"  extensions="dateInPBTbaleControllernewOk"  showHeader="false" sidebar="false">

<apex:pageMessages ></apex:pageMessages>
<style type="text/css" media="print">
@media print
{
#non-printable { display: none; }
#printable {
display: block;
width: 100%;
height: 100%;
}
}
</style>

<style type = "text/css">
        .colHeadr {text-align:center;}
        .colHeadrRight{
            text-align:right;
        }
        }
    </style>


        <apex:define name="body">
            
            <div style="width:1000px;margin: 0px auto 10px auto;border: 1px solid black;">
    <apex:form id="tableId">
        <apex:pageBlock >
            
                    <b><apex:outputLabel value="Trial Balance Report On: "  style="font-weight: bold;color:red;"/></b>
                     <apex:inputField value="{!account.DateUpdate__c}" style="font-weight: bold;color:red;" required="false"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;" oncomplete="window.opener.location.refresh();" />
        <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> <br/><br/><br/>
                
                 
                 <apex:outputPanel rendered="{!If(totalRevenue != totalRevenue1,true,false)}">
                 <apex:outputLabel style="font-weight: bold;color:red;font-size:15px;padding-left:49%"> Debit and Credit Balances do not match. </apex:outputLabel>
                 </apex:outputPanel>
                 
                 <apex:outputPanel rendered="{!If(account.DateUpdate__c== null,true,false)}">
                 <apex:outputLabel style="font-weight: bold;color:blue;font-size:15px;padding-left:1%" > Please enter date to fetch accurate results. </apex:outputLabel>
                 </apex:outputPanel>
                 
                 
                 
                 <apex:pageblockTable value="{!listAccount }" var="record">
               
                  <apex:column headerValue="Master Code" Value="{!record.Master_Name__c}" headerClass="colHeadr" style="font-weight: bold;font-size:12px;height=18px;text-align:center;">
                     <!----  <apex:column headerValue="Master Code">
                       <apex:outputPanel >
                            <apex:commandLink action="{!Go}">
                               {!record.Master_Name__c}<apex:param name="Id" value="{!record.id}"/>
                            </apex:commandLink>
                       </apex:outputPanel>
                    </apex:column>--->
                   
                   </apex:column>
                    <apex:column value="{!record.Master_Code__c}" headerValue="Master Name" headerClass="colHeadr" style="text-align:center;"/>
                    
                    
                    <apex:column value="{!record.Debit_Balance__c}" headerValue="Debit(+)" style="color:black;" headerClass="colHeadrRight" dir="RTL">
                     <apex:facet name="footer" >
        
                   <!---- <apex:outputText value=" Rs.{!totalRevenue}<br/> Rs.{!totalRevenuee}<br/>-----------------<br/> Rs.{!totalRevenuee1}" style="font-weight: bold;color:green;font-size:12px;height=18px;" escape="false">
                      
                       
                    </apex:outputText>-->
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:black;font-size:12px;height=18px;float:right;"  >
                        <apex:param value="{!totalRevenue}"  />
                    </apex:outputText> 
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.Credit_Balance__c}" headerValue="Credit(-)" style="color:black;"  headerClass="colHeadrRight" dir="RTL">
                    <apex:facet name="footer" >
                   
                        
                   <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:black;font-size:12px;height=18px;float:right;"  >
                        <apex:param value="{!totalRevenue1}"  />
                    </apex:outputText> 
                </apex:facet>
                 
            </apex:column>
            
           
          
                    </apex:pageblockTable>
                            
                    
        </apex:pageBlock>
    </apex:form>
    
      
      </div>
        </apex:define>
</apex:page>
public with sharing class dateInPBTbaleControllernewOk {
    public MasterCopy__c account{get;set;}
    public List<MasterCopy__c> listAccount {get;set;}
    public Double totalRevenue {get;set;}
    public Double totalRevenue1 {get;set;}
    public Double totalRevenuee {get;set;}
    public Double totalRevenuee1 {get;set;}
   
    public Date dat {get;set;}
    
    public Map<Date,List<MasterCopy__c>> mapOfDateWithEntry;

    public dateInPBTbaleControllernewOk(ApexPages.StandardController controller){
    
        account = new MasterCopy__c();
        totalRevenue = 0;
        totalRevenue1 = 0;
        totalRevenuee = 0;
        totalRevenuee1 = 0;
        
    }
     
   public void setValues(){
        listAccount  = new List<MasterCopy__c>([SELECT id,Name,  Closing_Balance__c,Credit__c,Date__c,DateUpdate__c,Debit__c,Debit_Balance__c,Credit_Balance__c,
        Group__c,Master_Code__c,Master_Name__c,New_Debit__c,New_Credit__c
                        FROM MasterCopy__c
                        order by Master_Name__c ASC ]);
        mapOfDateWithEntry = new Map<Date,List<MasterCopy__c>>();
        List<MasterCopy__c> listOfEntryData;
        for(MasterCopy__c entry : listAccount){
            if(entry.DateUpdate__c != null){
                if(mapOfDateWithEntry.containsKey(entry.DateUpdate__c)){
                    mapOfDateWithEntry.get(entry.DateUpdate__c).add(entry);
                }
                else{
                    listOfEntryData = new List<MasterCopy__c>();
                    listOfEntryData.add(entry);
                    mapOfDateWithEntry.put(entry.DateUpdate__c,listOfEntryData);
                }
            }
        }
        calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2();
   }
   public void displaingTable(){
   
   
   try{
   
        setValues();
        
        
        
 
        if(account.DateUpdate__c!= null){
            totalRevenue = 0;
            totalRevenue1 = 0;
            totalRevenuee = 0;
            totalRevenuee1 = 0;
            system.debug('Map '+mapOfDateWithEntry);
            Set<Date> allDateSet = mapOfDateWithEntry.keySet();
            if(allDateSet.contains(account.DateUpdate__c)){
                listAccount = mapOfDateWithEntry.get(account.DateUpdate__c);
            }
            else {
                List<Date> sortedDateList = new List<Date>();
                sortedDateList.addAll(allDateSet);
                sortedDateList.sort();
                
                Boolean isAnyPastDate = false;
                Date requiredDate;
                for(Date recordDate : sortedDateList){
                    if(account.DateUpdate__c > recordDate){
                        requiredDate = recordDate;
                        isAnyPastDate = true;
                    }
                    else{
                        break;
                    }
                }
                if(isAnyPastDate){
                    listAccount = mapOfDateWithEntry.get(requiredDate);
                }
                else{
                    listAccount = new List<MasterCopy__c>();
                }
                /*Date compareDate ;
                Integer count = 0;
                for(Date firstKeydate : allDateSet){
                    compareDate = firstKeydate;
                    break;
                }
                system.debug('Before Compare Date'+compareDate);
                for(Date keyDate : allDateSet){
                    if(keydate < account.DateUpdate__c && keydate > compareDate){
                        compareDate = keyDate;
                    }
                    if(account.DateUpdate__c < keyDate){
                        count ++ ;
                    }
                }
                system.debug('After Compare Date'+compareDate);
                Date requiredDate ;
                
                if(allDateSet.size() == count){
                    requiredDate = [Select DateUpdate__c from MasterCopy__c Order by DateUpdate__c Desc LIMIT 1][0].DateUpdate__c;
                }
                else {
                    requiredDate = compareDate;
                }
                listAccount = mapOfDateWithEntry.get(requiredDate);*/
            }
        }
       calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2(); 
    
    }
    
    catch(Exception e)
        {  
        //ApexPages.Message myMsg = new  ApexPages.Message(ApexPages.Severity.ERROR,'Sorry...... You have entered DUPLICATE MASTER CODE' );
           // ApexPages.addMessage(myMsg); 
         
           Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,' NO RECORD FOUND'));
       }
       } 
     public void calculateTotalRevenue() {
     //for(MasterCopy__c acct2 : listAccount) {
           // if(acct2.Closing_Balance__c!= null)
               // totalRevenuee= acct2.Closing_Balance__c;
                //}
        for(MasterCopy__c acct : listAccount) {
            if(acct.Debit_Balance__c!= null)
                totalRevenue+= acct.Debit_Balance__c;
                
                }
totalRevenuee1=totalRevenuee+totalRevenue;
             
       
        
    }
    
    
    
    public void calculateTotalRevenue2() {
        for(MasterCopy__c acct2 : listAccount) {
            if(acct2.Closing_Balance__c!= null)
                totalRevenuee= acct2.Closing_Balance__c;
            
              
        }
        
    }
    public void calculateTotalRevenue1() {
        for(MasterCopy__c acct1 : listAccount) {
            if(acct1.Credit_Balance__c!= null)
                totalRevenue1+= acct1.Credit_Balance__c;
                 
               
        }
        
    }
    
    
}


 
Hi All,

Is possible to use standard NAME field (data type is AutoNumber) as external ID while upserting/updating records using enterprice API.....